rahull30 commited on
Commit
e351e96
·
verified ·
1 Parent(s): adaabde

updated app.py

Browse files
Files changed (1) hide show
  1. app.py +41 -41
app.py CHANGED
@@ -1,41 +1,41 @@
1
- import gradio as gr
2
- from agent import ResearchAgent
3
-
4
- agent = ResearchAgent()
5
-
6
- def run_pipeline(file):
7
- try:
8
- if file is None:
9
- return "Upload a CSV file", None, None, None, None
10
-
11
- result = agent.execute_pipeline(file.name)
12
-
13
- if "error" in result:
14
- return result["error"], None, None, None, None
15
-
16
- return (
17
- "✅ Pipeline completed",
18
- "comparison.csv",
19
- "taxonomy_map.json",
20
- "topic_review_table.csv",
21
- "keywords.csv"
22
- )
23
-
24
- except Exception as e:
25
- return str(e), None, None, None, None
26
-
27
-
28
- demo = gr.Interface(
29
- fn=run_pipeline,
30
- inputs=gr.File(label="Upload CSV"),
31
- outputs=[
32
- gr.Textbox(label="Status"),
33
- gr.File(label="Download comparison.csv"),
34
- gr.File(label="Download taxonomy_map.json"),
35
- gr.File(label="Download topic_review_table.csv"),
36
- gr.File(label="Download keywords.csv"),
37
- ],
38
- title="Topic Modeling App"
39
- )
40
-
41
- demo.launch(share=True)
 
1
+ import gradio as gr
2
+ from agent import ResearchAgent
3
+
4
+ agent = ResearchAgent()
5
+
6
+ def run_pipeline(file):
7
+ try:
8
+ if file is None:
9
+ return "Upload a CSV file", None, None, None, None
10
+
11
+ result = agent.execute_pipeline(file.name)
12
+
13
+ if "error" in result:
14
+ return result["error"], None, None, None, None
15
+
16
+ return (
17
+ "✅ Pipeline completed",
18
+ "comparison.csv",
19
+ "taxonomy_map.json",
20
+ "topic_review_table.csv",
21
+ "keywords.csv"
22
+ )
23
+
24
+ except Exception as e:
25
+ return str(e), None, None, None, None
26
+
27
+
28
+ demo = gr.Interface(
29
+ fn=run_pipeline,
30
+ inputs=gr.File(label="Upload CSV"),
31
+ outputs=[
32
+ gr.Textbox(label="Status"),
33
+ gr.File(label="Download comparison.csv"),
34
+ gr.File(label="Download taxonomy_map.json"),
35
+ gr.File(label="Download topic_review_table.csv"),
36
+ gr.File(label="Download keywords.csv"),
37
+ ],
38
+ title="Topic Modeling App"
39
+ )
40
+
41
+ demo.launch()