Update app.py
Browse files
app.py
CHANGED
|
@@ -370,61 +370,7 @@ with gr.Blocks() as interface:
|
|
| 370 |
"""
|
| 371 |
)
|
| 372 |
with gr.Tabs():
|
| 373 |
-
|
| 374 |
-
with gr.Row():
|
| 375 |
-
with gr.Column(scale=1, min_width=250):
|
| 376 |
-
model = gr.Dropdown(
|
| 377 |
-
choices=[
|
| 378 |
-
"llama3-70b-8192",
|
| 379 |
-
"llama3-8b-8192",
|
| 380 |
-
"mixtral-8x7b-32768",
|
| 381 |
-
"gemma-7b-it",
|
| 382 |
-
"gemma2-9b-it",
|
| 383 |
-
],
|
| 384 |
-
value="llama3-70b-8192",
|
| 385 |
-
label="Model",
|
| 386 |
-
)
|
| 387 |
-
temperature = gr.Slider(
|
| 388 |
-
minimum=0.0,
|
| 389 |
-
maximum=1.0,
|
| 390 |
-
step=0.01,
|
| 391 |
-
value=0.5,
|
| 392 |
-
label="Temperature",
|
| 393 |
-
info="Controls diversity of the generated text. Lower is more deterministic, higher is more creative.",
|
| 394 |
-
)
|
| 395 |
-
max_tokens = gr.Slider(
|
| 396 |
-
minimum=1,
|
| 397 |
-
maximum=8192,
|
| 398 |
-
step=1,
|
| 399 |
-
value=4096,
|
| 400 |
-
label="Max Tokens",
|
| 401 |
-
info="The maximum number of tokens that the model can process in a single response.<br>Maximums: 8k for gemma 7b it, gemma2 9b it, llama 7b & 70b, 32k for mixtral 8x7b.",
|
| 402 |
-
)
|
| 403 |
-
top_p = gr.Slider(
|
| 404 |
-
minimum=0.0,
|
| 405 |
-
maximum=1.0,
|
| 406 |
-
step=0.01,
|
| 407 |
-
value=0.5,
|
| 408 |
-
label="Top P",
|
| 409 |
-
info="A method of text generation where a model will only consider the most probable next tokens that make up the probability p.",
|
| 410 |
-
)
|
| 411 |
-
seed = gr.Number(
|
| 412 |
-
precision=0, value=42, label="Seed", info="A starting point to initiate generation, use 0 for random"
|
| 413 |
-
)
|
| 414 |
-
model.change(update_max_tokens, inputs=[model], outputs=max_tokens)
|
| 415 |
-
with gr.Column(scale=1, min_width=400):
|
| 416 |
-
chatbot = gr.ChatInterface(
|
| 417 |
-
fn=generate_response,
|
| 418 |
-
chatbot=None,
|
| 419 |
-
additional_inputs=[
|
| 420 |
-
model,
|
| 421 |
-
temperature,
|
| 422 |
-
max_tokens,
|
| 423 |
-
top_p,
|
| 424 |
-
seed,
|
| 425 |
-
],
|
| 426 |
-
)
|
| 427 |
-
model.change(update_max_tokens, inputs=[model], outputs=max_tokens)
|
| 428 |
with gr.TabItem("Speech To Text"):
|
| 429 |
with gr.Tabs():
|
| 430 |
with gr.TabItem("Transcription"):
|
|
@@ -481,6 +427,64 @@ with gr.Blocks() as interface:
|
|
| 481 |
inputs=[audio_input_translate, model_choice_translate, translate_prompt],
|
| 482 |
outputs=translation_output,
|
| 483 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 484 |
|
| 485 |
|
| 486 |
interface.launch(share=True)
|
|
|
|
| 370 |
"""
|
| 371 |
)
|
| 372 |
with gr.Tabs():
|
| 373 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 374 |
with gr.TabItem("Speech To Text"):
|
| 375 |
with gr.Tabs():
|
| 376 |
with gr.TabItem("Transcription"):
|
|
|
|
| 427 |
inputs=[audio_input_translate, model_choice_translate, translate_prompt],
|
| 428 |
outputs=translation_output,
|
| 429 |
)
|
| 430 |
+
|
| 431 |
+
|
| 432 |
+
with gr.TabItem("LLMs"):
|
| 433 |
+
with gr.Row():
|
| 434 |
+
with gr.Column(scale=1, min_width=250):
|
| 435 |
+
model = gr.Dropdown(
|
| 436 |
+
choices=[
|
| 437 |
+
"llama3-70b-8192",
|
| 438 |
+
"llama3-8b-8192",
|
| 439 |
+
"mixtral-8x7b-32768",
|
| 440 |
+
"gemma-7b-it",
|
| 441 |
+
"gemma2-9b-it",
|
| 442 |
+
],
|
| 443 |
+
value="llama3-70b-8192",
|
| 444 |
+
label="Model",
|
| 445 |
+
)
|
| 446 |
+
temperature = gr.Slider(
|
| 447 |
+
minimum=0.0,
|
| 448 |
+
maximum=1.0,
|
| 449 |
+
step=0.01,
|
| 450 |
+
value=0.5,
|
| 451 |
+
label="Temperature",
|
| 452 |
+
info="Controls diversity of the generated text. Lower is more deterministic, higher is more creative.",
|
| 453 |
+
)
|
| 454 |
+
max_tokens = gr.Slider(
|
| 455 |
+
minimum=1,
|
| 456 |
+
maximum=8192,
|
| 457 |
+
step=1,
|
| 458 |
+
value=4096,
|
| 459 |
+
label="Max Tokens",
|
| 460 |
+
info="The maximum number of tokens that the model can process in a single response.<br>Maximums: 8k for gemma 7b it, gemma2 9b it, llama 7b & 70b, 32k for mixtral 8x7b.",
|
| 461 |
+
)
|
| 462 |
+
top_p = gr.Slider(
|
| 463 |
+
minimum=0.0,
|
| 464 |
+
maximum=1.0,
|
| 465 |
+
step=0.01,
|
| 466 |
+
value=0.5,
|
| 467 |
+
label="Top P",
|
| 468 |
+
info="A method of text generation where a model will only consider the most probable next tokens that make up the probability p.",
|
| 469 |
+
)
|
| 470 |
+
seed = gr.Number(
|
| 471 |
+
precision=0, value=42, label="Seed", info="A starting point to initiate generation, use 0 for random"
|
| 472 |
+
)
|
| 473 |
+
model.change(update_max_tokens, inputs=[model], outputs=max_tokens)
|
| 474 |
+
with gr.Column(scale=1, min_width=400):
|
| 475 |
+
chatbot = gr.ChatInterface(
|
| 476 |
+
fn=generate_response,
|
| 477 |
+
chatbot=None,
|
| 478 |
+
additional_inputs=[
|
| 479 |
+
model,
|
| 480 |
+
temperature,
|
| 481 |
+
max_tokens,
|
| 482 |
+
top_p,
|
| 483 |
+
seed,
|
| 484 |
+
],
|
| 485 |
+
)
|
| 486 |
+
model.change(update_max_tokens, inputs=[model], outputs=max_tokens)
|
| 487 |
+
|
| 488 |
|
| 489 |
|
| 490 |
interface.launch(share=True)
|