Don B
commited on
Commit
·
731c733
1
Parent(s):
976207b
add alternate source for dimensions
Browse files
app.py
CHANGED
@@ -10,7 +10,7 @@ def fetch_images(postID):
|
|
10 |
response.raise_for_status() # This will raise an exception for HTTP errors
|
11 |
data = response.json()
|
12 |
items = data["items"]
|
13 |
-
table_data = [[item["id"], item["meta"]["prompt"], item["meta"].get("negativePrompt", "N/A"), item["meta"]["Model"],item["meta"]["sampler"], item["meta"]["steps"], item["meta"]["cfgScale"], item["meta"].get("Size", "missing"), item["url"]] for item in items]
|
14 |
return table_data
|
15 |
except requests.RequestException as e:
|
16 |
st.error(f"Failed to fetch images: {e}")
|
@@ -29,7 +29,7 @@ def display_images(df):
|
|
29 |
st.markdown(f"**Model:** {row['Model']}")
|
30 |
st.markdown(f"**Sampler:** {row['sampler']} | **Steps:** {row['steps']}")
|
31 |
st.markdown(f"**Config Scale:** {row['cfgScale']}")
|
32 |
-
st.markdown(f"**Image Size:** {row['Size']} (W x H)")
|
33 |
def main():
|
34 |
st.title('Civitai Posts - Prompt Summary')
|
35 |
|
@@ -52,7 +52,7 @@ def main():
|
|
52 |
# Convert postID to integer if necessary
|
53 |
try:
|
54 |
postID_int = int(postID_input)
|
55 |
-
df = pd.DataFrame(fetch_images(postID_int), columns=["id", "prompt", "negativePrompt", "Model", "sampler", "steps", "cfgScale", "Size", "url"])
|
56 |
if not df.empty:
|
57 |
display_images(df)
|
58 |
else:
|
|
|
10 |
response.raise_for_status() # This will raise an exception for HTTP errors
|
11 |
data = response.json()
|
12 |
items = data["items"]
|
13 |
+
table_data = [[item["id"], item["meta"]["prompt"], item["meta"].get("negativePrompt", "N/A"), item["meta"]["Model"],item["meta"]["sampler"], item["meta"]["steps"], item["meta"]["cfgScale"], item["meta"].get("Size", "missing"), item["meta"].get("width", "missing"), item["meta"].get("height", "missing"), item["url"]] for item in items]
|
14 |
return table_data
|
15 |
except requests.RequestException as e:
|
16 |
st.error(f"Failed to fetch images: {e}")
|
|
|
29 |
st.markdown(f"**Model:** {row['Model']}")
|
30 |
st.markdown(f"**Sampler:** {row['sampler']} | **Steps:** {row['steps']}")
|
31 |
st.markdown(f"**Config Scale:** {row['cfgScale']}")
|
32 |
+
st.markdown(f"**Image Size:** {row['Size']} (W x H) OR {row['width']} x {row['height']} (W x H))")
|
33 |
def main():
|
34 |
st.title('Civitai Posts - Prompt Summary')
|
35 |
|
|
|
52 |
# Convert postID to integer if necessary
|
53 |
try:
|
54 |
postID_int = int(postID_input)
|
55 |
+
df = pd.DataFrame(fetch_images(postID_int), columns=["id", "prompt", "negativePrompt", "Model", "sampler", "steps", "cfgScale", "Size", "width", "height", "url"])
|
56 |
if not df.empty:
|
57 |
display_images(df)
|
58 |
else:
|