Futuresony commited on
Commit
acf9986
·
verified ·
1 Parent(s): 9d65752

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
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
- """Sends user input directly to the model without extra formatting."""
8
  response = client.text_generation(
9
- message.strip(), # ✅ Sends only the question
10
  max_new_tokens=max_tokens,
11
  temperature=temperature,
12
  top_p=top_p,
13
  )
14
 
15
- yield response.strip() # ✅ Removes unnecessary spaces/newlines
 
 
 
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,