Kedreamix commited on
Commit
baf2c4f
·
1 Parent(s): 4386bae
Files changed (1) hide show
  1. app.py +20 -12
app.py CHANGED
@@ -767,13 +767,13 @@ class Reader:
767
  print(f"Sort: {self.sort}")
768
 
769
 
770
- def upload_pdf(api_keys, text, model_name, p, temperature, file):
771
  # 检查两个输入都不为空
772
- api_key_list = None
773
- if api_keys:
774
- api_key_list = api_keys.split(',')
775
- elif not api_keys and valid_api_keys != []:
776
- api_key_list = valid_api_keys
777
  if not text or not file or not api_key_list:
778
  return "两个输入都不能为空,请输入字符并上传 PDF 文件!"
779
 
@@ -829,7 +829,7 @@ api_gui = gr.Interface(fn=valid_apikey,
829
  description=api_description)
830
 
831
  # 标题
832
- title = "ChatPaper(Gemini Pro)"
833
  # 描述
834
  description = api_description = '''<div align='left'>
835
 
@@ -854,9 +854,9 @@ Use Gemini Pro to summary the papers.Star our Github [🌟ChatPaperFree](https:/
854
  '''
855
  # 创建gr界面
856
  ip = [
857
- gr.Textbox(label="请输入你的API-key(必填, 多个API-key请用英文逗号隔开),不需要空格",
858
- value="",
859
- type='password'),
860
  gr.Textbox(
861
  label="请输入论文大标题索引(用英文逗号隔开,必填)",
862
  lines=3,
@@ -883,9 +883,17 @@ chatpaper_gui = gr.Interface(fn=upload_pdf,
883
  inputs=ip,
884
  outputs=[gr.Json(label = 'ChatPaperFree Tokens'), gr.Markdown(label = "ChatPaperFree 结果"), gr.File(label = "下载文章")],
885
  title=title,
886
- description=description)
 
 
 
 
 
 
 
 
887
 
888
  # Start server
889
  gui = gr.TabbedInterface(interface_list=[api_gui, chatpaper_gui],
890
- tab_names=["API-key", "ChatPaperFree"])
891
  gui.launch(quiet=True, show_api=False, debug=True)
 
767
  print(f"Sort: {self.sort}")
768
 
769
 
770
+ def upload_pdf( text, model_name, p, temperature, file):
771
  # 检查两个输入都不为空
772
+ api_key_list = [os.environ.get('GOOGLE_API_KEY')]
773
+ # if api_keys:
774
+ # api_key_list = api_keys.split(',')
775
+ # elif not api_keys and valid_api_keys != []:
776
+ # api_key_list = valid_api_keys
777
  if not text or not file or not api_key_list:
778
  return "两个输入都不能为空,请输入字符并上传 PDF 文件!"
779
 
 
829
  description=api_description)
830
 
831
  # 标题
832
+ title = "ChatPaperFree (Gemini Pro)"
833
  # 描述
834
  description = api_description = '''<div align='left'>
835
 
 
854
  '''
855
  # 创建gr界面
856
  ip = [
857
+ # gr.Textbox(label="请输入你的API-key(必填, 多个API-key请用英文逗号隔开),不需要空格",
858
+ # value="",
859
+ # type='password'),
860
  gr.Textbox(
861
  label="请输入论文大标题索引(用英文逗号隔开,必填)",
862
  lines=3,
 
883
  inputs=ip,
884
  outputs=[gr.Json(label = 'ChatPaperFree Tokens'), gr.Markdown(label = "ChatPaperFree 结果"), gr.File(label = "下载文章")],
885
  title=title,
886
+ description=description,
887
+ examples = [[
888
+ "'Abstract,Introduction,Related Work,Background,Preliminary,Problem Formulation,Methods,Methodology,Method,Approach,Approaches,Materials and Methods,Experiment Settings,Experiment,Experimental Results,Evaluation,Experiments,Results,Findings,Data Analysis,Discussion,Results and Discussion,Conclusion,References'",
889
+ 'gemini-Pro','1.0', '0.5', 'https://arxiv.org/pdf/2301.13430.pdf'
890
+ ],[
891
+ "'Abstract,Introduction,Related Work,Background,Preliminary,Problem Formulation,Methods,Methodology,Method,Approach,Approaches,Materials and Methods,Experiment Settings,Experiment,Experimental Results,Evaluation,Experiments,Results,Findings,Data Analysis,Discussion,Results and Discussion,Conclusion,References'",
892
+ 'gemini-Pro','1.0', '0.5', 'https://arxiv.org/pdf/2311.06772.pdf']
893
+ ]
894
+ )
895
 
896
  # Start server
897
  gui = gr.TabbedInterface(interface_list=[api_gui, chatpaper_gui],
898
+ tab_names=["ChatPaperFree"])
899
  gui.launch(quiet=True, show_api=False, debug=True)