Spaces:
Running on Zero
Running on Zero
Deploy provenance-first OpenComic-Continue research UI
Browse files
app.py
CHANGED
|
@@ -136,6 +136,22 @@ def record_preference(choice: str, notes: str) -> str:
|
|
| 136 |
return "Anonymous preference recorded for this research session."
|
| 137 |
|
| 138 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
with gr.Blocks(title="OpenComic-Continue") as demo:
|
| 140 |
gr.Markdown(
|
| 141 |
"# OpenComic-Continue\n"
|
|
@@ -151,6 +167,7 @@ with gr.Blocks(title="OpenComic-Continue") as demo:
|
|
| 151 |
)
|
| 152 |
direction = gr.Radio(["ltr", "rtl"], value="ltr", label="Reading direction")
|
| 153 |
analyze_button = gr.Button("Analyze comic", variant="primary")
|
|
|
|
| 154 |
analysis_summary = gr.Markdown()
|
| 155 |
memory_json = gr.JSON(label="StoryMemory")
|
| 156 |
analyze_button.click(
|
|
@@ -191,6 +208,18 @@ with gr.Blocks(title="OpenComic-Continue") as demo:
|
|
| 191 |
],
|
| 192 |
[gallery, scripts, memory_state, updated_memory, research_json],
|
| 193 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 194 |
with gr.Tab("Pairwise evaluation"):
|
| 195 |
gr.Markdown(
|
| 196 |
"Use this form after comparing two model outputs supplied by a study administrator. "
|
|
@@ -210,4 +239,4 @@ with gr.Blocks(title="OpenComic-Continue") as demo:
|
|
| 210 |
|
| 211 |
|
| 212 |
if __name__ == "__main__":
|
| 213 |
-
demo.launch()
|
|
|
|
| 136 |
return "Anonymous preference recorded for this research session."
|
| 137 |
|
| 138 |
|
| 139 |
+
def one_click_quality(files: list[str] | None, reading_direction: str):
|
| 140 |
+
session, memory, summary = analyze(files, reading_direction)
|
| 141 |
+
generated = generate(
|
| 142 |
+
session,
|
| 143 |
+
pages=1,
|
| 144 |
+
creativity=0.35,
|
| 145 |
+
dialogue_density=0.0,
|
| 146 |
+
style_fidelity=0.95,
|
| 147 |
+
character_fidelity=0.95,
|
| 148 |
+
reading_direction=reading_direction,
|
| 149 |
+
research_mode=True,
|
| 150 |
+
)
|
| 151 |
+
images, scripts, updated_session, updated_memory, research = generated
|
| 152 |
+
return images, scripts, updated_session, updated_memory, research, summary
|
| 153 |
+
|
| 154 |
+
|
| 155 |
with gr.Blocks(title="OpenComic-Continue") as demo:
|
| 156 |
gr.Markdown(
|
| 157 |
"# OpenComic-Continue\n"
|
|
|
|
| 167 |
)
|
| 168 |
direction = gr.Radio(["ltr", "rtl"], value="ltr", label="Reading direction")
|
| 169 |
analyze_button = gr.Button("Analyze comic", variant="primary")
|
| 170 |
+
one_click_button = gr.Button("Analyze + generate one quality page")
|
| 171 |
analysis_summary = gr.Markdown()
|
| 172 |
memory_json = gr.JSON(label="StoryMemory")
|
| 173 |
analyze_button.click(
|
|
|
|
| 208 |
],
|
| 209 |
[gallery, scripts, memory_state, updated_memory, research_json],
|
| 210 |
)
|
| 211 |
+
one_click_button.click(
|
| 212 |
+
one_click_quality,
|
| 213 |
+
[uploads, direction],
|
| 214 |
+
[
|
| 215 |
+
gallery,
|
| 216 |
+
scripts,
|
| 217 |
+
memory_state,
|
| 218 |
+
updated_memory,
|
| 219 |
+
research_json,
|
| 220 |
+
analysis_summary,
|
| 221 |
+
],
|
| 222 |
+
)
|
| 223 |
with gr.Tab("Pairwise evaluation"):
|
| 224 |
gr.Markdown(
|
| 225 |
"Use this form after comparing two model outputs supplied by a study administrator. "
|
|
|
|
| 239 |
|
| 240 |
|
| 241 |
if __name__ == "__main__":
|
| 242 |
+
demo.launch(show_error=True)
|