Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -84,9 +84,9 @@ def generate(prompt, history,max_new_tokens,health,temperature=temperature,top_p
|
|
| 84 |
for response in stream:
|
| 85 |
output += response.token.text
|
| 86 |
if history:
|
| 87 |
-
yield
|
| 88 |
else:
|
| 89 |
-
yield
|
| 90 |
generate_kwargs2 = dict(
|
| 91 |
temperature=temperature,
|
| 92 |
max_new_tokens=128,
|
|
@@ -139,9 +139,9 @@ def generate(prompt, history,max_new_tokens,health,temperature=temperature,top_p
|
|
| 139 |
|
| 140 |
if history:
|
| 141 |
history.append((prompt,output))
|
| 142 |
-
yield
|
| 143 |
else:
|
| 144 |
-
yield
|
| 145 |
|
| 146 |
def clear_fn():
|
| 147 |
return None,None
|
|
@@ -164,10 +164,10 @@ with gr.Blocks() as app:
|
|
| 164 |
chatbot = gr.Chatbot(label="Mixtral 8x7B Chatbot",height=300, layout='panel', show_copy_button=True)
|
| 165 |
with gr.Row():
|
| 166 |
with gr.Column(scale=3):
|
| 167 |
-
|
|
|
|
| 168 |
with gr.Column(scale=2):
|
| 169 |
button=gr.Button()
|
| 170 |
-
opt=gr.Dropdown(label="Choices")
|
| 171 |
#models_dd=gr.Dropdown(choices=[m for m in return_list],interactive=True)
|
| 172 |
with gr.Row():
|
| 173 |
stop_button=gr.Button("Stop")
|
|
@@ -186,8 +186,8 @@ with gr.Blocks() as app:
|
|
| 186 |
#text=gr.JSON()
|
| 187 |
#inp_query.change(search_models,inp_query,models_dd)
|
| 188 |
#test_b=test_btn.click(itt,url,e_box)
|
| 189 |
-
clear_btn.click(clear_fn,None,[
|
| 190 |
-
go=button.click(generate,[
|
| 191 |
stop_button.click(None,None,None,cancels=[go])
|
| 192 |
app.launch(show_api=False)
|
| 193 |
|
|
|
|
| 84 |
for response in stream:
|
| 85 |
output += response.token.text
|
| 86 |
if history:
|
| 87 |
+
yield [(prompt,output)],stats,None,None
|
| 88 |
else:
|
| 89 |
+
yield [(prompt,output)],stats,None,None
|
| 90 |
generate_kwargs2 = dict(
|
| 91 |
temperature=temperature,
|
| 92 |
max_new_tokens=128,
|
|
|
|
| 139 |
|
| 140 |
if history:
|
| 141 |
history.append((prompt,output))
|
| 142 |
+
yield history,stats,skills,opts
|
| 143 |
else:
|
| 144 |
+
yield [(prompt,output)],stats,skills,opts
|
| 145 |
|
| 146 |
def clear_fn():
|
| 147 |
return None,None
|
|
|
|
| 164 |
chatbot = gr.Chatbot(label="Mixtral 8x7B Chatbot",height=300, layout='panel', show_copy_button=True)
|
| 165 |
with gr.Row():
|
| 166 |
with gr.Column(scale=3):
|
| 167 |
+
opt=gr.Dropdown(label="Choices", value="Start a new game", interactive=True)
|
| 168 |
+
#prompt=gr.Textbox(label = "Prompt", value="Start a new game")
|
| 169 |
with gr.Column(scale=2):
|
| 170 |
button=gr.Button()
|
|
|
|
| 171 |
#models_dd=gr.Dropdown(choices=[m for m in return_list],interactive=True)
|
| 172 |
with gr.Row():
|
| 173 |
stop_button=gr.Button("Stop")
|
|
|
|
| 186 |
#text=gr.JSON()
|
| 187 |
#inp_query.change(search_models,inp_query,models_dd)
|
| 188 |
#test_b=test_btn.click(itt,url,e_box)
|
| 189 |
+
clear_btn.click(clear_fn,None,[opt,chatbot])
|
| 190 |
+
go=button.click(generate,[opt,chatbot,tokens,char_stats],[chatbot,char_stats,json_out,opt])
|
| 191 |
stop_button.click(None,None,None,cancels=[go])
|
| 192 |
app.launch(show_api=False)
|
| 193 |
|