Spaces:
Sleeping
Sleeping
Tuchuanhuhuhu
commited on
Commit
·
dfc7bef
1
Parent(s):
ef976df
页面加载时自动刷新usage
Browse files- ChuanhuChatbot.py +1 -0
- config_example.json +2 -2
- modules/utils.py +3 -0
ChuanhuChatbot.py
CHANGED
|
@@ -269,6 +269,7 @@ with gr.Blocks(css=customCSS, theme=small_and_beautiful_theme) as demo:
|
|
| 269 |
|
| 270 |
gr.Markdown(CHUANHU_DESCRIPTION, elem_id="description")
|
| 271 |
gr.HTML(FOOTER.format(versions=versions_html()), elem_id="footer")
|
|
|
|
| 272 |
chatgpt_predict_args = dict(
|
| 273 |
fn=predict,
|
| 274 |
inputs=[
|
|
|
|
| 269 |
|
| 270 |
gr.Markdown(CHUANHU_DESCRIPTION, elem_id="description")
|
| 271 |
gr.HTML(FOOTER.format(versions=versions_html()), elem_id="footer")
|
| 272 |
+
demo.load(refresh_ui_elements_on_load, [current_model], [usageTxt], show_progress=False)
|
| 273 |
chatgpt_predict_args = dict(
|
| 274 |
fn=predict,
|
| 275 |
inputs=[
|
config_example.json
CHANGED
|
@@ -2,8 +2,8 @@
|
|
| 2 |
// 你的OpenAI API Key,一般必填,
|
| 3 |
// 若缺省填为 "openai_api_key": "" 则必须再在图形界面中填入API Key
|
| 4 |
"openai_api_key": "",
|
| 5 |
-
// 你的
|
| 6 |
-
"
|
| 7 |
"language": "auto",
|
| 8 |
// 如果使用代理,请取消注释下面的两行,并替换代理URL
|
| 9 |
// "https_proxy": "http://127.0.0.1:1079",
|
|
|
|
| 2 |
// 你的OpenAI API Key,一般必填,
|
| 3 |
// 若缺省填为 "openai_api_key": "" 则必须再在图形界面中填入API Key
|
| 4 |
"openai_api_key": "",
|
| 5 |
+
// 你的xmchat API Key,与OpenAI API Key不同
|
| 6 |
+
"xmchat_api_key": "",
|
| 7 |
"language": "auto",
|
| 8 |
// 如果使用代理,请取消注释下面的两行,并替换代理URL
|
| 9 |
// "https_proxy": "http://127.0.0.1:1079",
|
modules/utils.py
CHANGED
|
@@ -531,3 +531,6 @@ def get_last_day_of_month(any_day):
|
|
| 531 |
def get_model_source(model_name, alternative_source):
|
| 532 |
if model_name == "gpt2-medium":
|
| 533 |
return "https://huggingface.co/gpt2-medium"
|
|
|
|
|
|
|
|
|
|
|
|
| 531 |
def get_model_source(model_name, alternative_source):
|
| 532 |
if model_name == "gpt2-medium":
|
| 533 |
return "https://huggingface.co/gpt2-medium"
|
| 534 |
+
|
| 535 |
+
def refresh_ui_elements_on_load(current_model):
|
| 536 |
+
return current_model.billing_info()
|