ZZZyx3587 commited on
Commit
3b1ebc4
·
verified ·
1 Parent(s): 1c6b9d2

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -28,14 +28,14 @@ except (ImportError, ModuleNotFoundError) as e:
28
  sys.exit(1)
29
 
30
 
31
- def diagnose(arxiv_url: str) -> str:
32
  """Gradio 回调:用户输入 arxiv URL → 返回 Markdown 研报"""
33
  url = arxiv_url.strip()
34
  if not url:
35
  return "## ⚠️ 请输入 arxiv 论文链接\n\n示例: `https://arxiv.org/abs/2011.08785`"
36
 
37
  try:
38
- result = run(url)
39
  except ValueError as e:
40
  return f"## ❌ 输入格式错误\n\n{str(e)}\n\n请确认输入的是有效的 arxiv 链接。"
41
  except RuntimeError as e:
@@ -353,8 +353,8 @@ AI 将在 3-5 分钟内生成一份完整的 **研究方向全景研报**,包
353
  """,
354
  )
355
 
356
- submit_btn.click(fn=diagnose, inputs=url_input, outputs=report_output, show_progress="minimal")
357
- url_input.submit(fn=diagnose, inputs=url_input, outputs=report_output, show_progress="minimal")
358
 
359
  demo.queue(default_concurrency_limit=3, max_size=20)
360
 
 
28
  sys.exit(1)
29
 
30
 
31
+ def diagnose(arxiv_url: str, progress: gr.Progress = gr.Progress()) -> str:
32
  """Gradio 回调:用户输入 arxiv URL → 返回 Markdown 研报"""
33
  url = arxiv_url.strip()
34
  if not url:
35
  return "## ⚠️ 请输入 arxiv 论文链接\n\n示例: `https://arxiv.org/abs/2011.08785`"
36
 
37
  try:
38
+ result = run(url, progress=progress)
39
  except ValueError as e:
40
  return f"## ❌ 输入格式错误\n\n{str(e)}\n\n请确认输入的是有效的 arxiv 链接。"
41
  except RuntimeError as e:
 
353
  """,
354
  )
355
 
356
+ submit_btn.click(fn=diagnose, inputs=url_input, outputs=report_output, show_progress=True)
357
+ url_input.submit(fn=diagnose, inputs=url_input, outputs=report_output, show_progress=True)
358
 
359
  demo.queue(default_concurrency_limit=3, max_size=20)
360