dev
This commit is contained in:
parent
22e7dc617b
commit
f0d9098df5
12
main.py
12
main.py
@ -93,6 +93,16 @@ with gr.Blocks(theme=set_theme, analytics_enabled=False) as demo:
|
|||||||
try: click_handle.then(on_report_generated, [file_upload, chatbot], [file_upload, chatbot])
|
try: click_handle.then(on_report_generated, [file_upload, chatbot], [file_upload, chatbot])
|
||||||
except: pass
|
except: pass
|
||||||
|
|
||||||
|
# gradio的inbrowser触发不太稳定,回滚代码到原始的浏览器打开函数
|
||||||
|
def auto_opentab_delay():
|
||||||
|
import threading, webbrowser, time
|
||||||
|
print(f"URL http://localhost:{PORT}")
|
||||||
|
def open():
|
||||||
|
time.sleep(2)
|
||||||
|
webbrowser.open_new_tab(f'http://localhost:{PORT}')
|
||||||
|
t = threading.Thread(target=open)
|
||||||
|
t.daemon = True; t.start()
|
||||||
|
|
||||||
|
auto_opentab_delay()
|
||||||
demo.title = "ChatGPT 学术优化"
|
demo.title = "ChatGPT 学术优化"
|
||||||
demo.queue(concurrency_count=CONCURRENT_COUNT).launch(server_name="0.0.0.0", share=True, server_port=PORT, inbrowser=True, auth=AUTHENTICATION)
|
demo.queue(concurrency_count=CONCURRENT_COUNT).launch(server_name="0.0.0.0", share=True, server_port=PORT, auth=AUTHENTICATION)
|
||||||
|
@ -207,7 +207,7 @@ def on_file_uploaded(files, chatbot, txt):
|
|||||||
txt = f'private_upload/{time_tag}'
|
txt = f'private_upload/{time_tag}'
|
||||||
moved_files_str = '\t\n\n'.join(moved_files)
|
moved_files_str = '\t\n\n'.join(moved_files)
|
||||||
chatbot.append(['我上传了文件,请查收',
|
chatbot.append(['我上传了文件,请查收',
|
||||||
f'[Local Message] 收到以下文件: \n\n{moved_files_str}\n\n调用路径参数已自动修正到: \n\n{txt}\n\n现在您可以直接选择任意实现性功能'])
|
f'[Local Message] 收到以下文件: \n\n{moved_files_str}\n\n调用路径参数已自动修正到: \n\n{txt}\n\n现在您点击任意实验功能时,以上文件将被作为输入参数'])
|
||||||
return chatbot, txt
|
return chatbot, txt
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user