Spaces:
Runtime error
Runtime error
Threatthriver
commited on
Commit
•
e84e0fa
1
Parent(s):
e7f3548
Update app.py
Browse files
app.py
CHANGED
@@ -67,41 +67,43 @@ def respond(
|
|
67 |
yield f"**Error:** {str(e)}"
|
68 |
|
69 |
|
70 |
-
# Define the
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
|
|
|
|
106 |
if __name__ == "__main__":
|
107 |
-
demo.launch()
|
|
|
67 |
yield f"**Error:** {str(e)}"
|
68 |
|
69 |
|
70 |
+
# Define the Gradio interface with the Blocks context
|
71 |
+
with gr.Blocks() as demo:
|
72 |
+
chat_interface = gr.ChatInterface(
|
73 |
+
fn=respond,
|
74 |
+
additional_inputs=[
|
75 |
+
gr.Textbox(
|
76 |
+
value="You are a friendly and helpful assistant.",
|
77 |
+
label="System message",
|
78 |
+
lines=2
|
79 |
+
),
|
80 |
+
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
81 |
+
gr.Slider(minimum=0.1, maximum=2.0, value=0.7, step=0.1, label="Temperature"),
|
82 |
+
gr.Slider(
|
83 |
+
minimum=0.1,
|
84 |
+
maximum=1.0,
|
85 |
+
value=0.95,
|
86 |
+
step=0.05,
|
87 |
+
label="Top-p (nucleus sampling)",
|
88 |
+
),
|
89 |
+
],
|
90 |
+
title="Zephyr 7B Beta Chatbot",
|
91 |
+
description="A customizable chatbot interface using Hugging Face's Zephyr 7B Beta model and Inference API.",
|
92 |
+
)
|
93 |
+
|
94 |
+
# Add the "Show Updates" button and output area
|
95 |
+
with gr.Row():
|
96 |
+
updates_button = gr.Button("Show Latest Updates")
|
97 |
+
updates_output = gr.Markdown(visible=False)
|
98 |
+
|
99 |
+
# Define the button's click event (now inside the Blocks context)
|
100 |
+
updates_button.click(
|
101 |
+
fn=lambda: latest_updates,
|
102 |
+
outputs=updates_output,
|
103 |
+
show_progress=False
|
104 |
+
)
|
105 |
+
|
106 |
+
|
107 |
+
# Launch the Gradio interface
|
108 |
if __name__ == "__main__":
|
109 |
+
demo.launch()
|