Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -61,7 +61,7 @@ def generate(
|
|
| 61 |
top_k,
|
| 62 |
top_p,
|
| 63 |
max_new_tokens,
|
| 64 |
-
repetition_penalty
|
| 65 |
):
|
| 66 |
client = Client(
|
| 67 |
model2endpoint[model_name]
|
|
@@ -109,7 +109,7 @@ def generate(
|
|
| 109 |
top_p=top_p,
|
| 110 |
repetition_penalty=repetition_penalty,
|
| 111 |
do_sample=True,
|
| 112 |
-
truncate=
|
| 113 |
seed=42,
|
| 114 |
stop_sequences=["<|end|>"],
|
| 115 |
)
|
|
@@ -138,7 +138,6 @@ def generate(
|
|
| 138 |
|
| 139 |
yield chat, history, user_message, ""
|
| 140 |
|
| 141 |
-
|
| 142 |
return chat, history, user_message, ""
|
| 143 |
|
| 144 |
|
|
@@ -164,7 +163,7 @@ def process_example(args):
|
|
| 164 |
return [x, y]
|
| 165 |
|
| 166 |
|
| 167 |
-
title = """<h1 align="center">⭐ StarChat
|
| 168 |
custom_css = """
|
| 169 |
#banner-image {
|
| 170 |
display: block;
|
|
@@ -181,7 +180,8 @@ custom_css = """
|
|
| 181 |
with gr.Blocks(analytics_enabled=False, css=custom_css) as demo:
|
| 182 |
gr.HTML(title)
|
| 183 |
|
| 184 |
-
|
|
|
|
| 185 |
|
| 186 |
with gr.Accordion(label="System Prompt", open=False, elem_id="parameters-accordion"):
|
| 187 |
system_message = gr.Textbox(
|
|
@@ -234,9 +234,9 @@ with gr.Blocks(analytics_enabled=False, css=custom_css) as demo:
|
|
| 234 |
)
|
| 235 |
max_new_tokens = gr.Slider(
|
| 236 |
label="Max new tokens",
|
| 237 |
-
value=
|
| 238 |
minimum=0,
|
| 239 |
-
maximum=
|
| 240 |
step=4,
|
| 241 |
interactive=True,
|
| 242 |
info="The maximum numbers of new tokens",
|
|
@@ -305,4 +305,4 @@ with gr.Blocks(analytics_enabled=False, css=custom_css) as demo:
|
|
| 305 |
selected_model.change(clear_chat, outputs=[chatbot, history])
|
| 306 |
# share_button.click(None, [], [], _js=share_js)
|
| 307 |
|
| 308 |
-
demo.queue(concurrency_count=16).launch(
|
|
|
|
| 61 |
top_k,
|
| 62 |
top_p,
|
| 63 |
max_new_tokens,
|
| 64 |
+
repetition_penalty,
|
| 65 |
):
|
| 66 |
client = Client(
|
| 67 |
model2endpoint[model_name]
|
|
|
|
| 109 |
top_p=top_p,
|
| 110 |
repetition_penalty=repetition_penalty,
|
| 111 |
do_sample=True,
|
| 112 |
+
truncate=1000,
|
| 113 |
seed=42,
|
| 114 |
stop_sequences=["<|end|>"],
|
| 115 |
)
|
|
|
|
| 138 |
|
| 139 |
yield chat, history, user_message, ""
|
| 140 |
|
|
|
|
| 141 |
return chat, history, user_message, ""
|
| 142 |
|
| 143 |
|
|
|
|
| 163 |
return [x, y]
|
| 164 |
|
| 165 |
|
| 166 |
+
title = """<h1 align="center">⭐ StarChat Playground 💬</h1>"""
|
| 167 |
custom_css = """
|
| 168 |
#banner-image {
|
| 169 |
display: block;
|
|
|
|
| 180 |
with gr.Blocks(analytics_enabled=False, css=custom_css) as demo:
|
| 181 |
gr.HTML(title)
|
| 182 |
|
| 183 |
+
with gr.Row():
|
| 184 |
+
selected_model = gr.Radio(choices=model_names, value=model_names[0], label="Select a model")
|
| 185 |
|
| 186 |
with gr.Accordion(label="System Prompt", open=False, elem_id="parameters-accordion"):
|
| 187 |
system_message = gr.Textbox(
|
|
|
|
| 234 |
)
|
| 235 |
max_new_tokens = gr.Slider(
|
| 236 |
label="Max new tokens",
|
| 237 |
+
value=1024,
|
| 238 |
minimum=0,
|
| 239 |
+
maximum=2048,
|
| 240 |
step=4,
|
| 241 |
interactive=True,
|
| 242 |
info="The maximum numbers of new tokens",
|
|
|
|
| 305 |
selected_model.change(clear_chat, outputs=[chatbot, history])
|
| 306 |
# share_button.click(None, [], [], _js=share_js)
|
| 307 |
|
| 308 |
+
demo.queue(concurrency_count=16).launch()
|