Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -49,10 +49,10 @@ def insert_sentence(text, sentence, interval):
|
|
49 |
# 定义Reviewer类
|
50 |
class Reviewer:
|
51 |
# 初始化方法,设置属性
|
52 |
-
def __init__(self, api, review_format, paper_pdf, language):
|
53 |
self.api = api
|
54 |
self.review_format = review_format
|
55 |
-
|
56 |
self.language = language
|
57 |
self.paper_pdf = paper_pdf
|
58 |
self.max_token_num = 12000
|
@@ -86,7 +86,7 @@ class Reviewer:
|
|
86 |
response = openai.ChatCompletion.create(
|
87 |
model="gpt-3.5-turbo-16k",
|
88 |
messages=messages,
|
89 |
-
temperature=0.
|
90 |
)
|
91 |
result = ''
|
92 |
for choice in response.choices:
|
@@ -131,7 +131,7 @@ class Reviewer:
|
|
131 |
break
|
132 |
return extracted_text
|
133 |
|
134 |
-
def main(api, review_format, paper_pdf, language):
|
135 |
start_time = time.time()
|
136 |
comments = ''
|
137 |
output2 = ''
|
@@ -141,7 +141,7 @@ def main(api, review_format, paper_pdf, language):
|
|
141 |
# 判断PDF文件
|
142 |
else:
|
143 |
# 创建一个Reader对象
|
144 |
-
reviewer1 = Reviewer(api, review_format, paper_pdf, language)
|
145 |
# 开始判断是路径还是文件:
|
146 |
comments, total_token_used = reviewer1.review_by_chatgpt(paper_list=paper_pdf)
|
147 |
time_used = time.time() - start_time
|
@@ -176,6 +176,8 @@ description = '''<div align='left'>
|
|
176 |
inp = [gradio.inputs.Textbox(label="请输入你的API-key(sk开头的字符串)",
|
177 |
default="",
|
178 |
type='password'),
|
|
|
|
|
179 |
gradio.inputs.Textbox(lines=5,
|
180 |
label="请输入特定的分析要求和格式(否则为默认格式)",
|
181 |
default="""* Overall Review
|
|
|
49 |
# 定义Reviewer类
|
50 |
class Reviewer:
|
51 |
# 初始化方法,设置属性
|
52 |
+
def __init__(self, api, api_base, review_format, paper_pdf, language):
|
53 |
self.api = api
|
54 |
self.review_format = review_format
|
55 |
+
self.api_base = api_base
|
56 |
self.language = language
|
57 |
self.paper_pdf = paper_pdf
|
58 |
self.max_token_num = 12000
|
|
|
86 |
response = openai.ChatCompletion.create(
|
87 |
model="gpt-3.5-turbo-16k",
|
88 |
messages=messages,
|
89 |
+
temperature=0.5
|
90 |
)
|
91 |
result = ''
|
92 |
for choice in response.choices:
|
|
|
131 |
break
|
132 |
return extracted_text
|
133 |
|
134 |
+
def main(api,api_base, review_format, paper_pdf, language):
|
135 |
start_time = time.time()
|
136 |
comments = ''
|
137 |
output2 = ''
|
|
|
141 |
# 判断PDF文件
|
142 |
else:
|
143 |
# 创建一个Reader对象
|
144 |
+
reviewer1 = Reviewer(api,api_base, review_format, paper_pdf, language)
|
145 |
# 开始判断是路径还是文件:
|
146 |
comments, total_token_used = reviewer1.review_by_chatgpt(paper_list=paper_pdf)
|
147 |
time_used = time.time() - start_time
|
|
|
176 |
inp = [gradio.inputs.Textbox(label="请输入你的API-key(sk开头的字符串)",
|
177 |
default="",
|
178 |
type='password'),
|
179 |
+
gradio.inputs.Textbox(label="请输入第三方中转网址",
|
180 |
+
default="https://api.openai.com/v1"),
|
181 |
gradio.inputs.Textbox(lines=5,
|
182 |
label="请输入特定的分析要求和格式(否则为默认格式)",
|
183 |
default="""* Overall Review
|