Spaces:
Runtime error
Runtime error
come
commited on
Commit
·
7cd454d
1
Parent(s):
97f45f9
Update app.py
Browse files
app.py
CHANGED
@@ -228,7 +228,7 @@ def GetAnswerV2(userText, GPTText, gptVersion,temperature,gptApiKey):
|
|
228 |
resData="{"+re.findall('\{(.*?)}',resData)[0]+'}'
|
229 |
|
230 |
dataJson = json.loads(resData)
|
231 |
-
|
232 |
if dataJson['Result'] == '改写不足':
|
233 |
dataJson['Result'] = '合格-改写不足'
|
234 |
# print(dataJson)
|
@@ -455,8 +455,9 @@ def test():
|
|
455 |
'ただいま〜🏠🎉疲れたニャ😿💤#SimejiAI'
|
456 |
'ただいま疲れたニャ'
|
457 |
|
458 |
-
def excelAIReviewTag(file_obj,gptVersion,tempor,gptApiKey):
|
459 |
global tmpdir
|
|
|
460 |
print('临时文件夹地址:{}'.format(tmpdir))
|
461 |
print('上传文件的地址:{}'.format(file_obj.name)) # 输出上传后的文件在gradio中保存的绝对地址
|
462 |
# 获取到上传后的文件的绝对路径后,其余的操作就和平常一致了
|
@@ -546,19 +547,20 @@ def gradioDemo():
|
|
546 |
drop = gr.components.Dropdown(label="GPTVersion", choices=GPTVersion,
|
547 |
value='gpt-4')
|
548 |
slider=gr.components.Slider(0, 1,label="Temperature", step=None, value=0.5)
|
|
|
549 |
|
550 |
button2 = gr.Button('开始审核')
|
551 |
|
552 |
button2.click(excelAIReviewTag, inputs=[inputs,drop,slider,gptApiKey], outputs=outputs)
|
553 |
gr.Markdown("## 文本例子")
|
554 |
gr.Examples(
|
555 |
-
[['
|
556 |
['無視すんな', 'やぁ、見てないよぉ〜🙈💭 #SimejiAI', 'gpt-4', 0.5]
|
557 |
],
|
558 |
[text_input, textGPTinput, drop, slider], outputText,
|
559 |
JuageRewritevEffect,
|
560 |
)
|
561 |
-
demo.launch()
|
562 |
|
563 |
|
564 |
|
|
|
228 |
resData="{"+re.findall('\{(.*?)}',resData)[0]+'}'
|
229 |
|
230 |
dataJson = json.loads(resData)
|
231 |
+
|
232 |
if dataJson['Result'] == '改写不足':
|
233 |
dataJson['Result'] = '合格-改写不足'
|
234 |
# print(dataJson)
|
|
|
455 |
'ただいま〜🏠🎉疲れたニャ😿💤#SimejiAI'
|
456 |
'ただいま疲れたニャ'
|
457 |
|
458 |
+
def excelAIReviewTag(file_obj,gptVersion,tempor,gptApiKey,progress=gr.Progress()):
|
459 |
global tmpdir
|
460 |
+
progress(0, desc="Starting...")
|
461 |
print('临时文件夹地址:{}'.format(tmpdir))
|
462 |
print('上传文件的地址:{}'.format(file_obj.name)) # 输出上传后的文件在gradio中保存的绝对地址
|
463 |
# 获取到上传后的文件的绝对路径后,其余的操作就和平常一致了
|
|
|
547 |
drop = gr.components.Dropdown(label="GPTVersion", choices=GPTVersion,
|
548 |
value='gpt-4')
|
549 |
slider=gr.components.Slider(0, 1,label="Temperature", step=None, value=0.5)
|
550 |
+
gptApiKey = gr.Textbox(label='GPTAPIKey', lines=2, placeholder='输入apiKey')
|
551 |
|
552 |
button2 = gr.Button('开始审核')
|
553 |
|
554 |
button2.click(excelAIReviewTag, inputs=[inputs,drop,slider,gptApiKey], outputs=outputs)
|
555 |
gr.Markdown("## 文本例子")
|
556 |
gr.Examples(
|
557 |
+
[['何時に帰ってくる?', 'いつ帰ってくるのかしら?わくわく😍✨ #SimejiAI', 'gpt-4', 0.5],['これ可愛い', 'これめっちゃ可愛いじゃん!😍💖💕 #SimejiAI', 'gpt-4', 0.5],
|
558 |
['無視すんな', 'やぁ、見てないよぉ〜🙈💭 #SimejiAI', 'gpt-4', 0.5]
|
559 |
],
|
560 |
[text_input, textGPTinput, drop, slider], outputText,
|
561 |
JuageRewritevEffect,
|
562 |
)
|
563 |
+
demo.queue(concurrency_count=20).launch()
|
564 |
|
565 |
|
566 |
|