nharshavardhana commited on
Commit
ac817f9
·
1 Parent(s): e2f66b0
Files changed (1) hide show
  1. app.py +22 -9
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.Interface(
342
- fn=query_agent,
343
- inputs=[
344
- gr.File(label="Upload EPUB", type="filepath"),
345
- gr.Textbox(label="Prompt", placeholder="e.g., Generate word frequency heatmap.")
346
- ],
347
- outputs=gr.Image(label="Sentiment Arc or Heatmap", type="filepath"),
348
- title="Book Analyzer"
349
- ).launch(share=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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)