Report actual model sources
Browse files
app.py
CHANGED
|
@@ -1157,6 +1157,12 @@ def build_model_report(rows: list[tuple[str, str, str]]) -> str:
|
|
| 1157 |
return "\n".join(f"{role}: prompt={prompt_model}; image={image_model}" for role, prompt_model, image_model in rows)
|
| 1158 |
|
| 1159 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1160 |
def generate_images_and_game(html_code: str, roles: str, style_hint: str):
|
| 1161 |
if not html_code.strip():
|
| 1162 |
return "", "Paste HTML game code first.", [], "", "", ""
|
|
@@ -1181,9 +1187,10 @@ def generate_images_and_game(html_code: str, roles: str, style_hint: str):
|
|
| 1181 |
errors.append(f"{spec.role}: fallback used ({error})")
|
| 1182 |
|
| 1183 |
rewritten = embed_assets(html_code, assets, specs)
|
| 1184 |
-
|
| 1185 |
-
|
| 1186 |
-
|
|
|
|
| 1187 |
if errors:
|
| 1188 |
status += "\n\n" + "\n".join(f"{item}: no HF image returned, used local style fallback" for item in [e.split(':', 1)[0] for e in errors])
|
| 1189 |
return rewritten, status, gallery, build_prompt_preview(specs), build_model_report(model_rows), build_preview(rewritten)
|
|
|
|
| 1157 |
return "\n".join(f"{role}: prompt={prompt_model}; image={image_model}" for role, prompt_model, image_model in rows)
|
| 1158 |
|
| 1159 |
|
| 1160 |
+
def summarize_model_sources(rows: list[tuple[str, str, str]]) -> str:
|
| 1161 |
+
prompt_sources = sorted({prompt_model for _, prompt_model, _ in rows})
|
| 1162 |
+
image_sources = sorted({image_model for _, _, image_model in rows})
|
| 1163 |
+
return f"prompt={', '.join(prompt_sources)}; image={', '.join(image_sources)}"
|
| 1164 |
+
|
| 1165 |
+
|
| 1166 |
def generate_images_and_game(html_code: str, roles: str, style_hint: str):
|
| 1167 |
if not html_code.strip():
|
| 1168 |
return "", "Paste HTML game code first.", [], "", "", ""
|
|
|
|
| 1187 |
errors.append(f"{spec.role}: fallback used ({error})")
|
| 1188 |
|
| 1189 |
rewritten = embed_assets(html_code, assets, specs)
|
| 1190 |
+
status = (
|
| 1191 |
+
f"Generated and embedded {len(specs)} fresh asset(s) using "
|
| 1192 |
+
f"{summarize_model_sources(model_rows)}. Run {str(run_id)[-6:]}."
|
| 1193 |
+
)
|
| 1194 |
if errors:
|
| 1195 |
status += "\n\n" + "\n".join(f"{item}: no HF image returned, used local style fallback" for item in [e.split(':', 1)[0] for e in errors])
|
| 1196 |
return rewritten, status, gallery, build_prompt_preview(specs), build_model_report(model_rows), build_preview(rewritten)
|