Armando Medina
commited on
Commit
·
6fa8b69
1
Parent(s):
86e8c59
updete client to post
Browse files
app.py
CHANGED
@@ -10,23 +10,23 @@ def respond(message, history, system_message, max_tokens, temperature, top_p):
|
|
10 |
"""
|
11 |
|
12 |
prompt = f"{system_message}\n\nUser: {message}\n\nAssistant:"
|
13 |
-
|
14 |
response = ""
|
15 |
|
16 |
try:
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
|
|
26 |
|
27 |
except Exception as e:
|
28 |
-
yield f"Error: {str(e)}"
|
29 |
-
|
30 |
|
31 |
# 🔹 Gradio Chat Interface
|
32 |
demo = gr.ChatInterface(
|
|
|
10 |
"""
|
11 |
|
12 |
prompt = f"{system_message}\n\nUser: {message}\n\nAssistant:"
|
13 |
+
|
14 |
response = ""
|
15 |
|
16 |
try:
|
17 |
+
# 🔥 Use raw API request instead of `text_generation()`
|
18 |
+
result = client.post(
|
19 |
+
json={"inputs": prompt, "parameters": {
|
20 |
+
"max_new_tokens": max_tokens,
|
21 |
+
"temperature": temperature,
|
22 |
+
"top_p": top_p
|
23 |
+
}},
|
24 |
+
)
|
25 |
+
response = result.text
|
26 |
+
yield response
|
27 |
|
28 |
except Exception as e:
|
29 |
+
yield f"Error: {str(e)}"
|
|
|
30 |
|
31 |
# 🔹 Gradio Chat Interface
|
32 |
demo = gr.ChatInterface(
|