Update app.py
Browse files
app.py
CHANGED
@@ -59,24 +59,29 @@ def gradio_predict(user_message, system_message, max_new_tokens, temperature, to
|
|
59 |
response = Tulu_bot.predict(user_message, temperature, max_new_tokens, top_p, repetition_penalty, do_sample)
|
60 |
return response
|
61 |
|
62 |
-
|
63 |
Tulu_bot = TuluChatBot(model, tokenizer)
|
64 |
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
gr.
|
71 |
-
|
72 |
-
gr.
|
73 |
-
gr.Slider(label="
|
74 |
-
gr.Slider(label="
|
75 |
-
gr.Slider(label="
|
76 |
-
|
77 |
-
|
78 |
-
outputs="text",
|
79 |
-
theme="ParityError/Anime"
|
80 |
-
)
|
81 |
|
82 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
response = Tulu_bot.predict(user_message, temperature, max_new_tokens, top_p, repetition_penalty, do_sample)
|
60 |
return response
|
61 |
|
|
|
62 |
Tulu_bot = TuluChatBot(model, tokenizer)
|
63 |
|
64 |
+
with gr.Blocks() as demo:
|
65 |
+
with gr.Row():
|
66 |
+
user_message = gr.Textbox(label="Your Message", lines=3)
|
67 |
+
system_message = gr.Textbox(label="Introduce a Character Here or Set a Scene (system prompt)", lines=2)
|
68 |
+
with gr.Row():
|
69 |
+
do_sample = gr.Checkbox(label="Advanced", value=True)
|
70 |
+
with gr.Row(visible=do_sample):
|
71 |
+
max_new_tokens = gr.Slider(label="Max new tokens", value=1269, minimum=550, maximum=3200, step=1)
|
72 |
+
temperature = gr.Slider(label="Temperature", value=1.2, minimum=0.05, maximum=4.0, step=0.05)
|
73 |
+
top_p = gr.Slider(label="Top-p (nucleus sampling)", value=0.90, minimum=0.01, maximum=0.99, step=0.05)
|
74 |
+
repetition_penalty = gr.Slider(label="Repetition penalty", value=1.9, minimum=1.0, maximum=2.0, step=0.05)
|
75 |
+
submit_button = gr.Button("Submit")
|
76 |
+
output_text = gr.Textbox()
|
|
|
|
|
|
|
77 |
|
78 |
+
def process(user_message, system_message, max_new_tokens, temperature, top_p, repetition_penalty, do_sample):
|
79 |
+
return gradio_predict(user_message, system_message, max_new_tokens, temperature, top_p, repetition_penalty, do_sample)
|
80 |
+
|
81 |
+
submit_button.click(
|
82 |
+
process,
|
83 |
+
inputs=[user_message, system_message, max_new_tokens, temperature, top_p, repetition_penalty, do_sample],
|
84 |
+
outputs=output_text
|
85 |
+
)
|
86 |
+
|
87 |
+
demo.launch()
|