Spaces:
Running
on
Zero
Running
on
Zero
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
@@ -17,6 +17,16 @@ def respond(message, history, system_message, max_tokens, temperature, top_p):
|
|
17 |
"""
|
18 |
Generate response from Hunyuan-MT model
|
19 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
# Build conversation history
|
21 |
messages = []
|
22 |
|
@@ -91,10 +101,11 @@ demo = gr.ChatInterface(
|
|
91 |
title="Hunyuan-MT-7B Chatbot",
|
92 |
description="Chat with Tencent's Hunyuan-MT-7B model. This model is particularly good at translation tasks.",
|
93 |
examples=[
|
94 |
-
["Translate to Chinese: It's on the house."],
|
95 |
-
["What are the main differences between Python and JavaScript?"],
|
96 |
-
["Explain quantum computing in simple terms."],
|
97 |
],
|
|
|
98 |
theme="soft"
|
99 |
)
|
100 |
|
|
|
17 |
"""
|
18 |
Generate response from Hunyuan-MT model
|
19 |
"""
|
20 |
+
# Set default values if None (happens during example caching)
|
21 |
+
if system_message is None:
|
22 |
+
system_message = "You are a helpful AI assistant."
|
23 |
+
if max_tokens is None:
|
24 |
+
max_tokens = 512
|
25 |
+
if temperature is None:
|
26 |
+
temperature = 0.7
|
27 |
+
if top_p is None:
|
28 |
+
top_p = 0.95
|
29 |
+
|
30 |
# Build conversation history
|
31 |
messages = []
|
32 |
|
|
|
101 |
title="Hunyuan-MT-7B Chatbot",
|
102 |
description="Chat with Tencent's Hunyuan-MT-7B model. This model is particularly good at translation tasks.",
|
103 |
examples=[
|
104 |
+
["Translate to Chinese: It's on the house.", "You are a helpful AI assistant.", 512, 0.7, 0.95],
|
105 |
+
["What are the main differences between Python and JavaScript?", "You are a helpful AI assistant.", 512, 0.7, 0.95],
|
106 |
+
["Explain quantum computing in simple terms.", "You are a helpful AI assistant.", 512, 0.7, 0.95],
|
107 |
],
|
108 |
+
cache_examples=False,
|
109 |
theme="soft"
|
110 |
)
|
111 |
|