Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -11,15 +11,11 @@ import fitz, io, os
|
|
11 |
from PIL import Image
|
12 |
import gradio
|
13 |
import markdown
|
14 |
-
import mistune
|
15 |
import json
|
16 |
import tiktoken
|
17 |
import concurrent.futures
|
18 |
from optimizeGoogle import chatPaper
|
19 |
|
20 |
-
proxy = {'http':'http://127.0.0.1',
|
21 |
-
'https':'http://127.0.0.1'}
|
22 |
-
|
23 |
def parse_text(text):
|
24 |
lines = text.split("\n")
|
25 |
for i, line in enumerate(lines):
|
@@ -56,13 +52,12 @@ valid_api_keys = []
|
|
56 |
|
57 |
def api_key_check(api_key):
|
58 |
try:
|
59 |
-
chat = chatPaper([api_key]
|
60 |
if chat.check_api_available():
|
61 |
return api_key
|
62 |
else:
|
63 |
return None
|
64 |
-
except
|
65 |
-
# print(e)
|
66 |
return None
|
67 |
|
68 |
|
@@ -381,8 +376,7 @@ class Reader:
|
|
381 |
apiTimeInterval=10,
|
382 |
temperature=temperature,
|
383 |
top_p=p,
|
384 |
-
model_name=model_name,
|
385 |
-
proxy=proxy) #openAI api封装
|
386 |
self.user_name = user_name # 读者姓名
|
387 |
self.key_word = key_word # 读者感兴趣的关键词
|
388 |
self.query = query # 读者输入的搜索查询
|
@@ -864,8 +858,8 @@ ip = [
|
|
864 |
default=
|
865 |
"'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'"
|
866 |
),
|
867 |
-
gradio.inputs.Radio(choices=["
|
868 |
-
default="
|
869 |
label="Select model"),
|
870 |
gradio.inputs.Slider(minimum=-0,
|
871 |
maximum=1.0,
|
@@ -889,4 +883,4 @@ chatpaper_gui = gradio.Interface(fn=upload_pdf,
|
|
889 |
# Start server
|
890 |
gui = gradio.TabbedInterface(interface_list=[api_gui, chatpaper_gui],
|
891 |
tab_names=["API-key", "ChatPaper"])
|
892 |
-
gui.launch(quiet=True, show_api=False
|
|
|
11 |
from PIL import Image
|
12 |
import gradio
|
13 |
import markdown
|
|
|
14 |
import json
|
15 |
import tiktoken
|
16 |
import concurrent.futures
|
17 |
from optimizeGoogle import chatPaper
|
18 |
|
|
|
|
|
|
|
19 |
def parse_text(text):
|
20 |
lines = text.split("\n")
|
21 |
for i, line in enumerate(lines):
|
|
|
52 |
|
53 |
def api_key_check(api_key):
|
54 |
try:
|
55 |
+
chat = chatPaper([api_key])
|
56 |
if chat.check_api_available():
|
57 |
return api_key
|
58 |
else:
|
59 |
return None
|
60 |
+
except:
|
|
|
61 |
return None
|
62 |
|
63 |
|
|
|
376 |
apiTimeInterval=10,
|
377 |
temperature=temperature,
|
378 |
top_p=p,
|
379 |
+
model_name=model_name,) #openAI api封装
|
|
|
380 |
self.user_name = user_name # 读者姓名
|
381 |
self.key_word = key_word # 读者感兴趣的关键词
|
382 |
self.query = query # 读者输入的搜索查询
|
|
|
858 |
default=
|
859 |
"'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'"
|
860 |
),
|
861 |
+
gradio.inputs.Radio(choices=["gpt-3.5-turbo", "gpt-3.5-turbo-0301"],
|
862 |
+
default="gpt-3.5-turbo",
|
863 |
label="Select model"),
|
864 |
gradio.inputs.Slider(minimum=-0,
|
865 |
maximum=1.0,
|
|
|
883 |
# Start server
|
884 |
gui = gradio.TabbedInterface(interface_list=[api_gui, chatpaper_gui],
|
885 |
tab_names=["API-key", "ChatPaper"])
|
886 |
+
gui.launch(quiet=True, show_api=False)
|