Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,6 +3,7 @@ from huggingface_hub import InferenceClient
|
|
| 3 |
|
| 4 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
| 5 |
|
|
|
|
| 6 |
def respond(
|
| 7 |
message,
|
| 8 |
history: list[tuple[str, str]],
|
|
@@ -35,27 +36,25 @@ def respond(
|
|
| 35 |
response += token
|
| 36 |
yield response
|
| 37 |
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
# Launch the Gradio app
|
| 59 |
if __name__ == "__main__":
|
| 60 |
-
|
| 61 |
-
interface.launch()
|
|
|
|
| 3 |
|
| 4 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
| 5 |
|
| 6 |
+
|
| 7 |
def respond(
|
| 8 |
message,
|
| 9 |
history: list[tuple[str, str]],
|
|
|
|
| 36 |
response += token
|
| 37 |
yield response
|
| 38 |
|
| 39 |
+
"""
|
| 40 |
+
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
| 41 |
+
"""
|
| 42 |
+
demo = gr.ChatInterface(
|
| 43 |
+
respond,
|
| 44 |
+
additional_inputs=[
|
| 45 |
+
gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
|
| 46 |
+
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
| 47 |
+
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
| 48 |
+
gr.Slider(
|
| 49 |
+
minimum=0.1,
|
| 50 |
+
maximum=1.0,
|
| 51 |
+
value=0.95,
|
| 52 |
+
step=0.05,
|
| 53 |
+
label="Top-p (nucleus sampling)",
|
| 54 |
+
),
|
| 55 |
+
],
|
| 56 |
+
)
|
| 57 |
+
|
| 58 |
+
|
|
|
|
| 59 |
if __name__ == "__main__":
|
| 60 |
+
demo.launch()
|
|
|