Omnibus commited on
Commit
2a37133
1 Parent(s): 369dc1f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -26,7 +26,7 @@ def format_prompt(message, history):
26
 
27
  def chat_inf(system_prompt,prompt,history,client_choice):
28
  #token max=8192
29
- client=clients[int(client_choice)]
30
  if not history:
31
  history = []
32
  hist_len=0
@@ -43,8 +43,8 @@ def chat_inf(system_prompt,prompt,history,client_choice):
43
  do_sample=True,
44
  seed=seed,
45
  )
46
-
47
- formatted_prompt = format_prompt(f"{system_prompt}, {prompt}", history)
48
  stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
49
  output = ""
50
 
@@ -68,5 +68,7 @@ with gr.Blocks() as app:
68
  stop_btn=gr.Button("Stop")
69
  clear_btn=gr.Button("Clear")
70
  client_choice=gr.Dropdown(label="Models",type='index',choices=[c for c in models],value=models[0],interactive=True)
71
- btn.click(chat_inf,[sys_inp,inp,chat_b,client_choice],chat_b)
 
 
72
  app.launch()
 
26
 
27
  def chat_inf(system_prompt,prompt,history,client_choice):
28
  #token max=8192
29
+ client=clients[int(client_choice)-1]
30
  if not history:
31
  history = []
32
  hist_len=0
 
43
  do_sample=True,
44
  seed=seed,
45
  )
46
+ formatted_prompt=prompt
47
+ #formatted_prompt = format_prompt(f"{system_prompt}, {prompt}", history)
48
  stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
49
  output = ""
50
 
 
68
  stop_btn=gr.Button("Stop")
69
  clear_btn=gr.Button("Clear")
70
  client_choice=gr.Dropdown(label="Models",type='index',choices=[c for c in models],value=models[0],interactive=True)
71
+ go=btn.click(chat_inf,[sys_inp,inp,chat_b,client_choice],chat_b)
72
+ stop_btn.click(None,None,None,cancels=go)
73
+
74
  app.launch()