Spaces:
Runtime error
Runtime error
dev
Browse files- main.py +11 -1
- toolbox.py +1 -1
main.py
CHANGED
@@ -93,6 +93,16 @@ with gr.Blocks(theme=set_theme, analytics_enabled=False) as demo:
|
|
93 |
try: click_handle.then(on_report_generated, [file_upload, chatbot], [file_upload, chatbot])
|
94 |
except: pass
|
95 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
|
|
|
97 |
demo.title = "ChatGPT 学术优化"
|
98 |
-
demo.queue(concurrency_count=CONCURRENT_COUNT).launch(server_name="0.0.0.0", share=True, server_port=PORT,
|
|
|
93 |
try: click_handle.then(on_report_generated, [file_upload, chatbot], [file_upload, chatbot])
|
94 |
except: pass
|
95 |
|
96 |
+
# gradio的inbrowser触发不太稳定,回滚代码到原始的浏览器打开函数
|
97 |
+
def auto_opentab_delay():
|
98 |
+
import threading, webbrowser, time
|
99 |
+
print(f"URL http://localhost:{PORT}")
|
100 |
+
def open():
|
101 |
+
time.sleep(2)
|
102 |
+
webbrowser.open_new_tab(f'http://localhost:{PORT}')
|
103 |
+
t = threading.Thread(target=open)
|
104 |
+
t.daemon = True; t.start()
|
105 |
|
106 |
+
auto_opentab_delay()
|
107 |
demo.title = "ChatGPT 学术优化"
|
108 |
+
demo.queue(concurrency_count=CONCURRENT_COUNT).launch(server_name="0.0.0.0", share=True, server_port=PORT, auth=AUTHENTICATION)
|
toolbox.py
CHANGED
@@ -207,7 +207,7 @@ def on_file_uploaded(files, chatbot, txt):
|
|
207 |
txt = f'private_upload/{time_tag}'
|
208 |
moved_files_str = '\t\n\n'.join(moved_files)
|
209 |
chatbot.append(['我上传了文件,请查收',
|
210 |
-
f'[Local Message] 收到以下文件: \n\n{moved_files_str}\n\n调用路径参数已自动修正到: \n\n{txt}\n\n
|
211 |
return chatbot, txt
|
212 |
|
213 |
|
|
|
207 |
txt = f'private_upload/{time_tag}'
|
208 |
moved_files_str = '\t\n\n'.join(moved_files)
|
209 |
chatbot.append(['我上传了文件,请查收',
|
210 |
+
f'[Local Message] 收到以下文件: \n\n{moved_files_str}\n\n调用路径参数已自动修正到: \n\n{txt}\n\n现在您点击任意实验功能时,以上文件将被作为输入参数'])
|
211 |
return chatbot, txt
|
212 |
|
213 |
|