Spaces:
Runtime error
Runtime error
Updated theme; added examples
Browse files
app.py
CHANGED
|
@@ -69,7 +69,11 @@ def chat(history, top_p, top_k, temperature):
|
|
| 69 |
|
| 70 |
title = """<h1 align="center">🔥RedPajama-INCITE-Chat-3B-v1</h1><br><h2 align="center">🏃♂️💨Streaming with Transformers & Gradio💪</h2>"""
|
| 71 |
description = """<br><br><h3 align="center">This is a RedPajama Chat model fine-tuned using data from Dolly 2.0 and Open Assistant over the RedPajama-INCITE-Base-3B-v1 base model.</h3>"""
|
| 72 |
-
theme = gr.themes.Soft(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
|
| 74 |
with gr.Blocks(theme=theme) as demo:
|
| 75 |
gr.HTML(title)
|
|
@@ -92,12 +96,21 @@ with gr.Blocks(theme=theme) as demo:
|
|
| 92 |
temperature = gr.Slider( minimum=-0, maximum=5.0, value=1.0, step=0.1, interactive=True, label="Temperature",)
|
| 93 |
|
| 94 |
submit_event = msg.submit(fn=user, inputs=[msg, chatbot], outputs=[msg, chatbot], queue=False).then(
|
| 95 |
-
fn=chat, inputs=[chatbot, top_p, top_k, temperature], outputs=[chatbot], queue=True)
|
| 96 |
submit_click_event = submit.click(fn=user, inputs=[msg, chatbot], outputs=[msg, chatbot], queue=False).then(
|
| 97 |
-
fn=chat, inputs=[chatbot, top_p, top_k, temperature], outputs=[chatbot], queue=True)
|
| 98 |
stop.click(fn=None, inputs=None, outputs=None, cancels=[
|
| 99 |
submit_event, submit_click_event], queue=False)
|
| 100 |
clear.click(lambda: None, None, [chatbot], queue=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
gr.HTML(description)
|
| 102 |
|
| 103 |
demo.queue(max_size=32, concurrency_count=2)
|
|
|
|
| 69 |
|
| 70 |
title = """<h1 align="center">🔥RedPajama-INCITE-Chat-3B-v1</h1><br><h2 align="center">🏃♂️💨Streaming with Transformers & Gradio💪</h2>"""
|
| 71 |
description = """<br><br><h3 align="center">This is a RedPajama Chat model fine-tuned using data from Dolly 2.0 and Open Assistant over the RedPajama-INCITE-Base-3B-v1 base model.</h3>"""
|
| 72 |
+
theme = gr.themes.Soft(
|
| 73 |
+
primary_hue=gr.themes.Color("#ededed", "#fee2e2", "#fecaca", "#fca5a5", "#f87171", "#ef4444", "#dc2626", "#b91c1c", "#991b1b", "#7f1d1d", "#6c1e1e"),
|
| 74 |
+
neutral_hue="red",
|
| 75 |
+
)
|
| 76 |
+
|
| 77 |
|
| 78 |
with gr.Blocks(theme=theme) as demo:
|
| 79 |
gr.HTML(title)
|
|
|
|
| 96 |
temperature = gr.Slider( minimum=-0, maximum=5.0, value=1.0, step=0.1, interactive=True, label="Temperature",)
|
| 97 |
|
| 98 |
submit_event = msg.submit(fn=user, inputs=[msg, chatbot], outputs=[msg, chatbot], queue=False).then(
|
| 99 |
+
fn=chat, inputs=[chatbot, top_p, top_k, temperature], outputs=[chatbot], queue=True) #inputs=[system_msg, chatbot]
|
| 100 |
submit_click_event = submit.click(fn=user, inputs=[msg, chatbot], outputs=[msg, chatbot], queue=False).then(
|
| 101 |
+
fn=chat, inputs=[chatbot, top_p, top_k, temperature], outputs=[chatbot], queue=True) #inputs=[system_msg, chatbot]
|
| 102 |
stop.click(fn=None, inputs=None, outputs=None, cancels=[
|
| 103 |
submit_event, submit_click_event], queue=False)
|
| 104 |
clear.click(lambda: None, None, [chatbot], queue=False)
|
| 105 |
+
|
| 106 |
+
gr.Examples([
|
| 107 |
+
["Hello there! How are you doing?"],
|
| 108 |
+
["Can you explain to me briefly what is Python programming language?"],
|
| 109 |
+
["Explain the plot of Cinderella in a sentence."],
|
| 110 |
+
["What are some common mistakes to avoid when writing code?"],
|
| 111 |
+
["Write a 500-word blog post on “Benefits of Artificial Intelligence"]
|
| 112 |
+
], inputs=msg, label= "Click on any example and press the 'Submit' button"
|
| 113 |
+
)
|
| 114 |
gr.HTML(description)
|
| 115 |
|
| 116 |
demo.queue(max_size=32, concurrency_count=2)
|