Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -104,8 +104,7 @@ with gr.Blocks(css='style.css') as demo:
|
|
104 |
retry_button = gr.Button('π Retry', variant='secondary')
|
105 |
undo_button = gr.Button('β©οΈ Undo', variant='secondary')
|
106 |
clear_button = gr.Button('ποΈ Clear', variant='secondary')
|
107 |
-
|
108 |
-
gr.Markdown(LICENSE)
|
109 |
saved_input = gr.State()
|
110 |
|
111 |
with gr.Accordion(label='Advanced options', open=False):
|
@@ -124,7 +123,7 @@ with gr.Blocks(css='style.css') as demo:
|
|
124 |
minimum=0.1,
|
125 |
maximum=4.0,
|
126 |
step=0.1,
|
127 |
-
value=0.
|
128 |
)
|
129 |
top_p = gr.Slider(
|
130 |
label='Top-p (nucleus sampling)',
|
@@ -141,6 +140,7 @@ with gr.Blocks(css='style.css') as demo:
|
|
141 |
value=10,
|
142 |
)
|
143 |
|
|
|
144 |
|
145 |
textbox.submit(
|
146 |
fn=clear_and_save_textbox,
|
@@ -205,4 +205,53 @@ with gr.Blocks(css='style.css') as demo:
|
|
205 |
outputs=chatbot,
|
206 |
api_name=False,
|
207 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
demo.queue(max_size=20).launch()
|
|
|
104 |
retry_button = gr.Button('π Retry', variant='secondary')
|
105 |
undo_button = gr.Button('β©οΈ Undo', variant='secondary')
|
106 |
clear_button = gr.Button('ποΈ Clear', variant='secondary')
|
107 |
+
|
|
|
108 |
saved_input = gr.State()
|
109 |
|
110 |
with gr.Accordion(label='Advanced options', open=False):
|
|
|
123 |
minimum=0.1,
|
124 |
maximum=4.0,
|
125 |
step=0.1,
|
126 |
+
value=0.2,
|
127 |
)
|
128 |
top_p = gr.Slider(
|
129 |
label='Top-p (nucleus sampling)',
|
|
|
140 |
value=10,
|
141 |
)
|
142 |
|
143 |
+
gr.Markdown(LICENSE)
|
144 |
|
145 |
textbox.submit(
|
146 |
fn=clear_and_save_textbox,
|
|
|
205 |
outputs=chatbot,
|
206 |
api_name=False,
|
207 |
)
|
208 |
+
|
209 |
+
retry_button.click(
|
210 |
+
fn=delete_prev_fn,
|
211 |
+
inputs=chatbot,
|
212 |
+
outputs=[chatbot, saved_input],
|
213 |
+
api_name=False,
|
214 |
+
queue=False,
|
215 |
+
).then(
|
216 |
+
fn=display_input,
|
217 |
+
inputs=[saved_input, chatbot],
|
218 |
+
outputs=chatbot,
|
219 |
+
api_name=False,
|
220 |
+
queue=False,
|
221 |
+
).then(
|
222 |
+
fn=generate,
|
223 |
+
inputs=[
|
224 |
+
saved_input,
|
225 |
+
chatbot,
|
226 |
+
system_prompt,
|
227 |
+
max_new_tokens,
|
228 |
+
temperature,
|
229 |
+
top_p,
|
230 |
+
top_k,
|
231 |
+
],
|
232 |
+
outputs=chatbot,
|
233 |
+
api_name=False,
|
234 |
+
)
|
235 |
+
|
236 |
+
undo_button.click(
|
237 |
+
fn=delete_prev_fn,
|
238 |
+
inputs=chatbot,
|
239 |
+
outputs=[chatbot, saved_input],
|
240 |
+
api_name=False,
|
241 |
+
queue=False,
|
242 |
+
).then(
|
243 |
+
fn=lambda x: x,
|
244 |
+
inputs=[saved_input],
|
245 |
+
outputs=textbox,
|
246 |
+
api_name=False,
|
247 |
+
queue=False,
|
248 |
+
)
|
249 |
+
|
250 |
+
clear_button.click(
|
251 |
+
fn=lambda: ([], ''),
|
252 |
+
outputs=[chatbot, saved_input],
|
253 |
+
queue=False,
|
254 |
+
api_name=False,
|
255 |
+
)
|
256 |
+
|
257 |
demo.queue(max_size=20).launch()
|