acecalisto3 commited on
Commit
355d9b5
·
verified ·
1 Parent(s): c224179

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -13
app.py CHANGED
@@ -264,15 +264,15 @@ def generate(
264
  )
265
 
266
  formatted_prompt = format_prompt(f"{system_prompt}, {prompt}", history)
267
- stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
268
- output = ""
269
-
270
- for response in stream:
271
- output += response.token.text
272
- yield output
273
 
274
  return output
275
 
 
 
 
 
 
276
  additional_inputs = [
277
  gr.Dropdown(
278
  label="Agents",
@@ -343,13 +343,6 @@ def create_interface():
343
  )
344
  return iface
345
 
346
- def chat_interface(prompt, history, agent_name, sys_prompt, temperature, max_new_tokens, top_p, repetition_penalty):
347
- generated_text = generate(prompt, history, agent_name, sys_prompt, temperature, max_new_tokens, top_p, repetition_penalty)
348
- chatbot_response = []
349
- for response in generated_text:
350
- chatbot_response.append([prompt, response])
351
- return chatbot_response, "" # Return the chatbot response and an empty string for the message textbox
352
-
353
  iface = gr.Blocks()
354
 
355
  with iface:
 
264
  )
265
 
266
  formatted_prompt = format_prompt(f"{system_prompt}, {prompt}", history)
267
+ output = client.text_generation(formatted_prompt, **generate_kwargs, stream=False, return_full_text=True)
 
 
 
 
 
268
 
269
  return output
270
 
271
+ def chat_interface(prompt, history, agent_name, sys_prompt, temperature, max_new_tokens, top_p, repetition_penalty):
272
+ generated_text = generate(prompt, history, agent_name, sys_prompt, temperature, max_new_tokens, top_p, repetition_penalty)
273
+ chatbot_response = [(prompt, generated_text)]
274
+ return chatbot_response, "" # Return the chatbot response and an empty string for the message textbox
275
+
276
  additional_inputs = [
277
  gr.Dropdown(
278
  label="Agents",
 
343
  )
344
  return iface
345
 
 
 
 
 
 
 
 
346
  iface = gr.Blocks()
347
 
348
  with iface: