Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -26,12 +26,10 @@ class Response:
|
|
26 |
stop=tenacity.stop_after_attempt(5),
|
27 |
reraise=True)
|
28 |
def chat_response(self):
|
29 |
-
openai.api_key = self.
|
30 |
-
self.cur_api += 1
|
31 |
-
self.cur_api = 0 if self.cur_api >= len(self.chat_api_list)-1 else self.cur_api
|
32 |
response_prompt_token = 1000
|
33 |
text_token = len(self.encoding.encode(self.comment))
|
34 |
-
input_text_index = int(len(
|
35 |
input_text = "This is the review comments:" + text[:input_text_index]
|
36 |
messages=[
|
37 |
{"role": "system", "content": """You are the author, you submitted a paper, and the reviewers gave the review comments.
|
@@ -101,7 +99,7 @@ title = "🤖ChatResponse🤖"
|
|
101 |
# 描述
|
102 |
|
103 |
description = '''<div align='left'>
|
104 |
-
<img align='right' src='http://i.imgtg.com/2023/03/22/94PLN.png' width="
|
105 |
|
106 |
<strong>ChatResponse是一款根据审稿人的评论自动生成作者回复的AI助手。</strong>其用途为:
|
107 |
|
@@ -128,7 +126,7 @@ inp = [gradio.inputs.Textbox(label="请输入你的API-key(sk开头的字符串)
|
|
128 |
|
129 |
chat_Response_gui = gradio.Interface(fn=main,
|
130 |
inputs=inp,
|
131 |
-
outputs = [gradio.Textbox(lines=
|
132 |
title=title,
|
133 |
description=description)
|
134 |
|
|
|
26 |
stop=tenacity.stop_after_attempt(5),
|
27 |
reraise=True)
|
28 |
def chat_response(self):
|
29 |
+
openai.api_key = self.api
|
|
|
|
|
30 |
response_prompt_token = 1000
|
31 |
text_token = len(self.encoding.encode(self.comment))
|
32 |
+
input_text_index = int(len(self.comment)*(self.max_token_num-response_prompt_token)/text_token)
|
33 |
input_text = "This is the review comments:" + text[:input_text_index]
|
34 |
messages=[
|
35 |
{"role": "system", "content": """You are the author, you submitted a paper, and the reviewers gave the review comments.
|
|
|
99 |
# 描述
|
100 |
|
101 |
description = '''<div align='left'>
|
102 |
+
<img align='right' src='http://i.imgtg.com/2023/03/22/94PLN.png' width="220">
|
103 |
|
104 |
<strong>ChatResponse是一款根据审稿人的评论自动生成作者回复的AI助手。</strong>其用途为:
|
105 |
|
|
|
126 |
|
127 |
chat_Response_gui = gradio.Interface(fn=main,
|
128 |
inputs=inp,
|
129 |
+
outputs = [gradio.Textbox(lines=11, label="回复结果"), gradio.Textbox(lines=2, label="资源统计")],
|
130 |
title=title,
|
131 |
description=description)
|
132 |
|