Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -24,7 +24,6 @@ def respond(
|
|
| 24 |
top_p,
|
| 25 |
):
|
| 26 |
try:
|
| 27 |
-
print_now('req')
|
| 28 |
default_system ='You are a helpful assistant.'
|
| 29 |
|
| 30 |
messages = [{"Role": "system", "Content": default_system}]
|
|
@@ -39,7 +38,6 @@ def respond(
|
|
| 39 |
clientProfile.httpProfile = httpProfile
|
| 40 |
client = hunyuan_client.HunyuanClient(cred, "", clientProfile)
|
| 41 |
req = models.ChatCompletionsRequest()
|
| 42 |
-
print_now('res')
|
| 43 |
|
| 44 |
for val in history:
|
| 45 |
if val[0] and val[1]:
|
|
@@ -68,7 +66,6 @@ def respond(
|
|
| 68 |
response += token
|
| 69 |
if isFirst:
|
| 70 |
print(event)
|
| 71 |
-
print_now('first')
|
| 72 |
isFirst = False
|
| 73 |
yield response
|
| 74 |
|
|
@@ -77,13 +74,11 @@ def respond(
|
|
| 77 |
except Exception as e:
|
| 78 |
raise gr.Error(f"发生错误: {str(e)}")
|
| 79 |
|
| 80 |
-
print_now('end')
|
| 81 |
|
| 82 |
demo = gr.ChatInterface(respond,
|
| 83 |
title="Hunyuan-Large"
|
| 84 |
)
|
| 85 |
|
| 86 |
if __name__ == "__main__":
|
| 87 |
-
print_now('init')
|
| 88 |
demo.queue(default_concurrency_limit=40)
|
| 89 |
demo.launch(max_threads=40)
|
|
|
|
| 24 |
top_p,
|
| 25 |
):
|
| 26 |
try:
|
|
|
|
| 27 |
default_system ='You are a helpful assistant.'
|
| 28 |
|
| 29 |
messages = [{"Role": "system", "Content": default_system}]
|
|
|
|
| 38 |
clientProfile.httpProfile = httpProfile
|
| 39 |
client = hunyuan_client.HunyuanClient(cred, "", clientProfile)
|
| 40 |
req = models.ChatCompletionsRequest()
|
|
|
|
| 41 |
|
| 42 |
for val in history:
|
| 43 |
if val[0] and val[1]:
|
|
|
|
| 66 |
response += token
|
| 67 |
if isFirst:
|
| 68 |
print(event)
|
|
|
|
| 69 |
isFirst = False
|
| 70 |
yield response
|
| 71 |
|
|
|
|
| 74 |
except Exception as e:
|
| 75 |
raise gr.Error(f"发生错误: {str(e)}")
|
| 76 |
|
|
|
|
| 77 |
|
| 78 |
demo = gr.ChatInterface(respond,
|
| 79 |
title="Hunyuan-Large"
|
| 80 |
)
|
| 81 |
|
| 82 |
if __name__ == "__main__":
|
|
|
|
| 83 |
demo.queue(default_concurrency_limit=40)
|
| 84 |
demo.launch(max_threads=40)
|