simondby
commited on
Commit
·
643ad6a
1
Parent(s):
0e3fd4b
update
Browse files- .gitignore +2 -1
- app.py +12 -11
- modules/overwrites.py +1 -1
- requirements.txt +1 -1
.gitignore
CHANGED
@@ -139,4 +139,5 @@ auth.json
|
|
139 |
.idea
|
140 |
|
141 |
deprecated/
|
142 |
-
.vscode
|
|
|
|
139 |
.idea
|
140 |
|
141 |
deprecated/
|
142 |
+
.vscode
|
143 |
+
thunder-tests
|
app.py
CHANGED
@@ -274,9 +274,9 @@ with gr.Blocks(css=customCSS, theme=gr.themes.Soft()) as demo:
|
|
274 |
fn=end_outputing, inputs=[], outputs=[submitBtn, cancelBtn]
|
275 |
)
|
276 |
|
277 |
-
reset_textbox_args = dict(
|
278 |
-
|
279 |
-
)
|
280 |
|
281 |
transfer_input_args = dict(
|
282 |
fn=transfer_input, inputs=[user_input], outputs=[user_question, user_input, submitBtn, cancelBtn], show_progress=True
|
@@ -291,17 +291,17 @@ with gr.Blocks(css=customCSS, theme=gr.themes.Soft()) as demo:
|
|
291 |
cancelBtn.click(cancel_outputing, [], [])
|
292 |
|
293 |
user_input.submit(**transfer_input_args).then(**chatgpt_predict_args).then(**end_outputing_args)
|
294 |
-
user_input.submit(**get_usage_args)
|
295 |
|
296 |
submitBtn.click(**transfer_input_args).then(**chatgpt_predict_args).then(**end_outputing_args)
|
297 |
-
submitBtn.click(**get_usage_args)
|
298 |
|
299 |
emptyBtn.click(
|
300 |
reset_state,
|
301 |
outputs=[chatbot, history, token_count, status_display],
|
302 |
show_progress=True,
|
303 |
)
|
304 |
-
emptyBtn.click(**reset_textbox_args)
|
305 |
|
306 |
retryBtn.click(**start_outputing_args).then(
|
307 |
retry,
|
@@ -320,7 +320,7 @@ with gr.Blocks(css=customCSS, theme=gr.themes.Soft()) as demo:
|
|
320 |
[chatbot, history, status_display, token_count],
|
321 |
show_progress=True,
|
322 |
).then(**end_outputing_args)
|
323 |
-
retryBtn.click(**get_usage_args)
|
324 |
|
325 |
delFirstBtn.click(
|
326 |
delete_first_conversation,
|
@@ -352,11 +352,12 @@ with gr.Blocks(css=customCSS, theme=gr.themes.Soft()) as demo:
|
|
352 |
[chatbot, history, status_display, token_count],
|
353 |
show_progress=True,
|
354 |
)
|
355 |
-
reduceTokenBtn.click(**get_usage_args)
|
356 |
|
357 |
# ChatGPT
|
358 |
-
keyTxt.change(submit_key, keyTxt, [user_api_key, status_display]).then(**get_usage_args)
|
359 |
-
keyTxt.
|
|
|
360 |
|
361 |
# Template
|
362 |
templateRefreshBtn.click(get_template_names, None, [templateFileSelectDropdown])
|
@@ -431,7 +432,7 @@ with gr.Blocks(css=customCSS, theme=gr.themes.Soft()) as demo:
|
|
431 |
|
432 |
logging.info(
|
433 |
colorama.Back.WHITE
|
434 |
-
+ "
|
435 |
+ colorama.Style.RESET_ALL
|
436 |
)
|
437 |
# 默认开启本地服务器,默认可以直接从IP访问,默认不创建公开分享链接
|
|
|
274 |
fn=end_outputing, inputs=[], outputs=[submitBtn, cancelBtn]
|
275 |
)
|
276 |
|
277 |
+
# reset_textbox_args = dict(
|
278 |
+
# fn=reset_textbox, inputs=[], outputs=[user_input]
|
279 |
+
# )
|
280 |
|
281 |
transfer_input_args = dict(
|
282 |
fn=transfer_input, inputs=[user_input], outputs=[user_question, user_input, submitBtn, cancelBtn], show_progress=True
|
|
|
291 |
cancelBtn.click(cancel_outputing, [], [])
|
292 |
|
293 |
user_input.submit(**transfer_input_args).then(**chatgpt_predict_args).then(**end_outputing_args)
|
294 |
+
# user_input.submit(**get_usage_args)
|
295 |
|
296 |
submitBtn.click(**transfer_input_args).then(**chatgpt_predict_args).then(**end_outputing_args)
|
297 |
+
# submitBtn.click(**get_usage_args)
|
298 |
|
299 |
emptyBtn.click(
|
300 |
reset_state,
|
301 |
outputs=[chatbot, history, token_count, status_display],
|
302 |
show_progress=True,
|
303 |
)
|
304 |
+
# emptyBtn.click(**reset_textbox_args)
|
305 |
|
306 |
retryBtn.click(**start_outputing_args).then(
|
307 |
retry,
|
|
|
320 |
[chatbot, history, status_display, token_count],
|
321 |
show_progress=True,
|
322 |
).then(**end_outputing_args)
|
323 |
+
# retryBtn.click(**get_usage_args)
|
324 |
|
325 |
delFirstBtn.click(
|
326 |
delete_first_conversation,
|
|
|
352 |
[chatbot, history, status_display, token_count],
|
353 |
show_progress=True,
|
354 |
)
|
355 |
+
# reduceTokenBtn.click(**get_usage_args)
|
356 |
|
357 |
# ChatGPT
|
358 |
+
# keyTxt.change(submit_key, keyTxt, [user_api_key, status_display]).then(**get_usage_args)
|
359 |
+
keyTxt.change(submit_key, keyTxt, [user_api_key, status_display])
|
360 |
+
# keyTxt.submit(**get_usage_args)
|
361 |
|
362 |
# Template
|
363 |
templateRefreshBtn.click(get_template_names, None, [templateFileSelectDropdown])
|
|
|
432 |
|
433 |
logging.info(
|
434 |
colorama.Back.WHITE
|
435 |
+
+ "🚀 访问:http://localhost:7860"
|
436 |
+ colorama.Style.RESET_ALL
|
437 |
)
|
438 |
# 默认开启本地服务器,默认可以直接从IP访问,默认不创建公开分享链接
|
modules/overwrites.py
CHANGED
@@ -43,7 +43,7 @@ with open("./assets/custom.js", "r", encoding="utf-8") as f, open("./assets/Kelp
|
|
43 |
kelpyCodos = f2.read()
|
44 |
|
45 |
def reload_javascript():
|
46 |
-
|
47 |
js = f'<script>{customJS}</script><script>{kelpyCodos}</script>'
|
48 |
def template_response(*args, **kwargs):
|
49 |
res = GradioTemplateResponseOriginal(*args, **kwargs)
|
|
|
43 |
kelpyCodos = f2.read()
|
44 |
|
45 |
def reload_javascript():
|
46 |
+
logging.info("加载JavaScript文件")
|
47 |
js = f'<script>{customJS}</script><script>{kelpyCodos}</script>'
|
48 |
def template_response(*args, **kwargs):
|
49 |
res = GradioTemplateResponseOriginal(*args, **kwargs)
|
requirements.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
gradio
|
2 |
mdtex2html
|
3 |
pypinyin
|
4 |
tiktoken
|
|
|
1 |
+
gradio==3.23.0
|
2 |
mdtex2html
|
3 |
pypinyin
|
4 |
tiktoken
|