emeses commited on
Commit
62e9f3c
·
1 Parent(s): 0895bcd

Update space

Browse files
Files changed (1) hide show
  1. app.py +7 -17
app.py CHANGED
@@ -16,31 +16,21 @@ def respond(
16
  temperature,
17
  top_p,
18
  ):
19
- # Format conversation history into a text prompt
20
- prompt = f"{system_message}\n\n"
21
 
22
- for user_msg, assistant_msg in history:
23
- prompt += f"User: {user_msg}\n"
24
- if assistant_msg:
25
- prompt += f"Assistant: {assistant_msg}\n"
26
-
27
- prompt += f"User: {message}\nAssistant:"
28
-
29
  response = ""
30
  try:
31
- # Use text_generation instead of chat_completion
32
- for chunk in client.text_generation(
33
  prompt,
34
  max_new_tokens=max_tokens,
35
  temperature=temperature,
36
  top_p=top_p,
37
- stream=True
38
- ):
39
- if chunk:
40
- response += chunk
41
- yield response
42
  except Exception as e:
43
- yield f"Error: {str(e)}"
44
 
45
  """
46
  For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
 
16
  temperature,
17
  top_p,
18
  ):
19
+ # Simpler prompt format
20
+ prompt = message
21
 
 
 
 
 
 
 
 
22
  response = ""
23
  try:
24
+ # Basic text generation without streaming first
25
+ response = client.text_generation(
26
  prompt,
27
  max_new_tokens=max_tokens,
28
  temperature=temperature,
29
  top_p=top_p,
30
+ )
31
+ return response
 
 
 
32
  except Exception as e:
33
+ return f"Error: {str(e)}"
34
 
35
  """
36
  For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface