Spaces:
Sleeping
Sleeping
DeepMount00
commited on
Commit
•
a71fb86
1
Parent(s):
4d7115d
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
-
# app.py
|
2 |
import os
|
3 |
from threading import Thread
|
4 |
from typing import Iterator
|
@@ -282,58 +281,64 @@ def create_chat_interface():
|
|
282 |
gr.Markdown(DESCRIPTION)
|
283 |
|
284 |
with gr.Column(elem_classes="chat-container"):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
285 |
chat_interface = gr.ChatInterface(
|
286 |
fn=generate,
|
287 |
-
additional_inputs=
|
288 |
-
gr.Textbox(
|
289 |
-
value="",
|
290 |
-
label="System Message",
|
291 |
-
elem_classes="system-message",
|
292 |
-
render=False,
|
293 |
-
),
|
294 |
-
gr.Column(elem_classes="controls-container") as controls:
|
295 |
-
with controls:
|
296 |
-
gr.Slider(
|
297 |
-
label="Maximum New Tokens",
|
298 |
-
minimum=1,
|
299 |
-
maximum=MAX_MAX_NEW_TOKENS,
|
300 |
-
step=1,
|
301 |
-
value=DEFAULT_MAX_NEW_TOKENS,
|
302 |
-
elem_classes="slider-label",
|
303 |
-
),
|
304 |
-
gr.Slider(
|
305 |
-
label="Temperature",
|
306 |
-
minimum=0,
|
307 |
-
maximum=4.0,
|
308 |
-
step=0.1,
|
309 |
-
value=0.001,
|
310 |
-
elem_classes="slider-label",
|
311 |
-
),
|
312 |
-
gr.Slider(
|
313 |
-
label="Top-p (Nucleus Sampling)",
|
314 |
-
minimum=0.05,
|
315 |
-
maximum=1.0,
|
316 |
-
step=0.05,
|
317 |
-
value=1.0,
|
318 |
-
elem_classes="slider-label",
|
319 |
-
),
|
320 |
-
gr.Slider(
|
321 |
-
label="Top-k",
|
322 |
-
minimum=1,
|
323 |
-
maximum=1000,
|
324 |
-
step=1,
|
325 |
-
value=50,
|
326 |
-
elem_classes="slider-label",
|
327 |
-
),
|
328 |
-
gr.Slider(
|
329 |
-
label="Repetition Penalty",
|
330 |
-
minimum=1.0,
|
331 |
-
maximum=2.0,
|
332 |
-
step=0.05,
|
333 |
-
value=1.0,
|
334 |
-
elem_classes="slider-label",
|
335 |
-
),
|
336 |
-
],
|
337 |
examples=[
|
338 |
["Ciao! Come stai?"],
|
339 |
["Raccontami una breve storia."],
|
|
|
|
|
1 |
import os
|
2 |
from threading import Thread
|
3 |
from typing import Iterator
|
|
|
281 |
gr.Markdown(DESCRIPTION)
|
282 |
|
283 |
with gr.Column(elem_classes="chat-container"):
|
284 |
+
additional_inputs = [
|
285 |
+
gr.Textbox(
|
286 |
+
value="",
|
287 |
+
label="System Message",
|
288 |
+
elem_classes="system-message",
|
289 |
+
render=False,
|
290 |
+
),
|
291 |
+
]
|
292 |
+
|
293 |
+
# Create controls without context manager
|
294 |
+
controls = gr.Column(elem_classes="controls-container")
|
295 |
+
with controls:
|
296 |
+
additional_inputs.extend([
|
297 |
+
gr.Slider(
|
298 |
+
label="Maximum New Tokens",
|
299 |
+
minimum=1,
|
300 |
+
maximum=MAX_MAX_NEW_TOKENS,
|
301 |
+
step=1,
|
302 |
+
value=DEFAULT_MAX_NEW_TOKENS,
|
303 |
+
elem_classes="slider-label",
|
304 |
+
),
|
305 |
+
gr.Slider(
|
306 |
+
label="Temperature",
|
307 |
+
minimum=0,
|
308 |
+
maximum=4.0,
|
309 |
+
step=0.1,
|
310 |
+
value=0.001,
|
311 |
+
elem_classes="slider-label",
|
312 |
+
),
|
313 |
+
gr.Slider(
|
314 |
+
label="Top-p (Nucleus Sampling)",
|
315 |
+
minimum=0.05,
|
316 |
+
maximum=1.0,
|
317 |
+
step=0.05,
|
318 |
+
value=1.0,
|
319 |
+
elem_classes="slider-label",
|
320 |
+
),
|
321 |
+
gr.Slider(
|
322 |
+
label="Top-k",
|
323 |
+
minimum=1,
|
324 |
+
maximum=1000,
|
325 |
+
step=1,
|
326 |
+
value=50,
|
327 |
+
elem_classes="slider-label",
|
328 |
+
),
|
329 |
+
gr.Slider(
|
330 |
+
label="Repetition Penalty",
|
331 |
+
minimum=1.0,
|
332 |
+
maximum=2.0,
|
333 |
+
step=0.05,
|
334 |
+
value=1.0,
|
335 |
+
elem_classes="slider-label",
|
336 |
+
),
|
337 |
+
])
|
338 |
+
|
339 |
chat_interface = gr.ChatInterface(
|
340 |
fn=generate,
|
341 |
+
additional_inputs=additional_inputs,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
342 |
examples=[
|
343 |
["Ciao! Come stai?"],
|
344 |
["Raccontami una breve storia."],
|