Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -4,15 +4,18 @@ from huggingface_hub import InferenceClient
|
|
4 |
client = InferenceClient("Futuresony/future_ai_12_10_2024.gguf")
|
5 |
|
6 |
def respond(message, history, max_tokens, temperature, top_p):
|
7 |
-
"""
|
8 |
response = client.text_generation(
|
9 |
-
message.strip(),
|
10 |
max_new_tokens=max_tokens,
|
11 |
temperature=temperature,
|
12 |
top_p=top_p,
|
13 |
)
|
14 |
|
15 |
-
|
|
|
|
|
|
|
16 |
|
17 |
demo = gr.ChatInterface(
|
18 |
respond,
|
|
|
4 |
client = InferenceClient("Futuresony/future_ai_12_10_2024.gguf")
|
5 |
|
6 |
def respond(message, history, max_tokens, temperature, top_p):
|
7 |
+
"""Generates only a short, direct response without extra text."""
|
8 |
response = client.text_generation(
|
9 |
+
message.strip(),
|
10 |
max_new_tokens=max_tokens,
|
11 |
temperature=temperature,
|
12 |
top_p=top_p,
|
13 |
)
|
14 |
|
15 |
+
# ✅ Remove "I am... ", "What do you do?", "Can you help me...?", etc.
|
16 |
+
response = response.strip().split("\n")[0] # Keep only the first line
|
17 |
+
|
18 |
+
yield response
|
19 |
|
20 |
demo = gr.ChatInterface(
|
21 |
respond,
|