Spaces:
Runtime error
Runtime error
Commit
·
ac817f9
1
Parent(s):
e2f66b0
commit
Browse files
app.py
CHANGED
@@ -338,12 +338,25 @@ def query_agent(epub_file, prompt):
|
|
338 |
else:
|
339 |
return f"No plot image found. Raw response: {final_output}"
|
340 |
|
341 |
-
gr.
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
338 |
else:
|
339 |
return f"No plot image found. Raw response: {final_output}"
|
340 |
|
341 |
+
with gr.Blocks() as demo:
|
342 |
+
gr.Markdown("### Chaptered - AI-Powered Novel Analyzer")
|
343 |
+
gr.Markdown("""
|
344 |
+
Upload your EPUB file and enter a prompt to analyze the novel.
|
345 |
+
You can ask for a word frequency heatmap, sentiment arc, or chapter-wise word count plot.
|
346 |
+
""")
|
347 |
+
|
348 |
+
with gr.Row():
|
349 |
+
with gr.Column():
|
350 |
+
epub_input = gr.File(label="Upload EPUB", type="filepath")
|
351 |
+
prompt_input = gr.Textbox(label="Prompt", placeholder="e.g., Generate word frequency heatmap.")
|
352 |
+
analyze_button = gr.Button("Analyze")
|
353 |
+
with gr.Column():
|
354 |
+
output_image = gr.Image(label="Sentiment Arc or Heatmap", type="filepath")
|
355 |
+
|
356 |
+
analyze_button.click(
|
357 |
+
fn=query_agent,
|
358 |
+
inputs=[epub_input, prompt_input],
|
359 |
+
outputs=output_image
|
360 |
+
)
|
361 |
+
|
362 |
+
demo.launch(share=True)
|