65 lines
1.8 KiB
Python
65 lines
1.8 KiB
Python
import json
|
|
from collections import Counter
|
|
|
|
SAS = "sp=racwdli&st=2023-09-17T15:37:58Z&se=2023-12-31T23:37:58Z&spr=https&sv=2022-11-02&sr=c&sig=u%2FPbZ4fNttAPeLj0NEEpX0eIgFcjhot%2Bmy3iGd%2BCmxk%3D" # e.g sp=r&st=...
|
|
|
|
with open("sample_cdfs.json", "r") as f:
|
|
data = []
|
|
for line in f:
|
|
data.append(json.load(f))
|
|
|
|
print("""
|
|
<html>
|
|
<head>
|
|
<style>
|
|
.row {
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: start;
|
|
align-items: center;
|
|
margin-bottom: 16px;
|
|
}
|
|
.column {
|
|
flex: 15%;
|
|
padding: 0 16px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
""")
|
|
|
|
for index, item in enumerate(data):
|
|
# NOTE: replace xxxxxxxxx with SAS!
|
|
file = f"https://internblob.blob.core.windows.net/v-lixinyang/canva-render-11.30/{item['rendered_folder']}-()?{SAS}"
|
|
if index % 1 == 0:
|
|
print('<div class="row">')
|
|
print(f"""
|
|
<div class="column">
|
|
<img src="{gt_file}" alt="image" style="max-width: 100%;">
|
|
</div>
|
|
<div class="column">
|
|
<img src="{file}" alt="image" style="max-width: 100%;">
|
|
</div>
|
|
<div class="column">
|
|
<img src="{if_file}" alt="image" style="max-width: 100%;">
|
|
</div>
|
|
<div class="column">
|
|
<img src="{sdxl_file}" alt="image" style="max-width: 100%;">
|
|
</div>
|
|
""")
|
|
if index % 1 == 0:
|
|
print('</div>')
|
|
print(f"""
|
|
<div class="row">
|
|
<p>Index: {index} <br>
|
|
Category: {item["category"]} <br>
|
|
{item["caption"]} <br>
|
|
Tags: {item["tags"]} <br>
|
|
Texts: {item["texts"]}</p>
|
|
</div>
|
|
""")
|
|
|
|
print("""
|
|
</body>
|
|
</html>
|
|
""")
|