anujjuna commited on
Commit
8d9f7e0
·
verified ·
1 Parent(s): 81717bb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -214,7 +214,6 @@ def build_app():
214
  label="Thematic Analysis Agent",
215
  height=500,
216
  avatar_images=(None, "https://www.anthropic.com/favicon.ico"),
217
- type="messages",
218
  )
219
  with gr.Row():
220
  user_input = gr.Textbox(
@@ -241,8 +240,8 @@ def build_app():
241
  review_table = gr.Dataframe(
242
  headers=["#", "Topic Label", "Top Evidence", "Sentences", "Papers", "Approve", "Rename To", "Reasoning"],
243
  datatype=["str", "str", "str", "number", "str", "str", "str", "str"],
244
- row_count=(10, "dynamic"),
245
- col_count=(8, "fixed"),
246
  interactive=True,
247
  wrap=True,
248
  label="",
@@ -282,10 +281,11 @@ def build_app():
282
  def on_csv_upload(file, history, thread_id):
283
  if file is None:
284
  return history, build_phase_bar(), load_review_table()
285
- msg = f"Analyze my Scopus CSV: {file.name}"
 
286
  history = history or []
287
- history.append({"role": "user", "content": msg})
288
- response = invoke_agent(f"load_scopus_csv filepath={file.name}", thread_id)
289
  history.append({"role": "assistant", "content": response})
290
  return history, build_phase_bar(), load_review_table()
291
 
@@ -372,7 +372,6 @@ if __name__ == "__main__":
372
  demo.launch(
373
  server_name="0.0.0.0",
374
  server_port=7860,
375
- ssr_mode=False,
376
  share=False,
377
  theme=gr.themes.Base(
378
  primary_hue="emerald",
 
214
  label="Thematic Analysis Agent",
215
  height=500,
216
  avatar_images=(None, "https://www.anthropic.com/favicon.ico"),
 
217
  )
218
  with gr.Row():
219
  user_input = gr.Textbox(
 
240
  review_table = gr.Dataframe(
241
  headers=["#", "Topic Label", "Top Evidence", "Sentences", "Papers", "Approve", "Rename To", "Reasoning"],
242
  datatype=["str", "str", "str", "number", "str", "str", "str", "str"],
243
+ row_count=10,
244
+ column_count=8,
245
  interactive=True,
246
  wrap=True,
247
  label="",
 
281
  def on_csv_upload(file, history, thread_id):
282
  if file is None:
283
  return history, build_phase_bar(), load_review_table()
284
+ # In Gradio 6, uploaded file is a filepath string
285
+ filepath = file if isinstance(file, str) else file.name
286
  history = history or []
287
+ history.append({"role": "user", "content": f"CSV uploaded: {os.path.basename(filepath)}"})
288
+ response = invoke_agent(f"load_scopus_csv filepath={filepath}", thread_id)
289
  history.append({"role": "assistant", "content": response})
290
  return history, build_phase_bar(), load_review_table()
291
 
 
372
  demo.launch(
373
  server_name="0.0.0.0",
374
  server_port=7860,
 
375
  share=False,
376
  theme=gr.themes.Base(
377
  primary_hue="emerald",