Spaces:
Sleeping
Sleeping
UPDATE
Browse files
app.py
CHANGED
|
@@ -2,7 +2,7 @@ import gradio as gr
|
|
| 2 |
from huggingface_hub import InferenceClient
|
| 3 |
|
| 4 |
"""
|
| 5 |
-
For more information on
|
| 6 |
"""
|
| 7 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
| 8 |
|
|
@@ -43,73 +43,22 @@ def respond(
|
|
| 43 |
"""
|
| 44 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
| 45 |
"""
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
gr.
|
| 52 |
-
gr.Slider(
|
| 53 |
-
|
| 54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
],
|
| 56 |
-
outputs=gr.Chatbot(),
|
| 57 |
-
layout="vertical",
|
| 58 |
-
title="Zephyr Chatbot",
|
| 59 |
-
description="A friendly AI-powered chatbot powered by HuggingFace's Zephyr-7B.",
|
| 60 |
-
theme="huggingface",
|
| 61 |
)
|
| 62 |
|
| 63 |
-
# Adding custom CSS for style improvements
|
| 64 |
-
demo.launch(
|
| 65 |
-
server_name="0.0.0.0",
|
| 66 |
-
server_port=7860,
|
| 67 |
-
inline=False,
|
| 68 |
-
css="""
|
| 69 |
-
.gradio-container {
|
| 70 |
-
font-family: 'Arial', sans-serif;
|
| 71 |
-
background-color: #f5f5f5;
|
| 72 |
-
padding: 20px;
|
| 73 |
-
}
|
| 74 |
-
|
| 75 |
-
#system-message {
|
| 76 |
-
background-color: #e0f7fa;
|
| 77 |
-
border-radius: 8px;
|
| 78 |
-
border: 1px solid #00796b;
|
| 79 |
-
}
|
| 80 |
-
|
| 81 |
-
.gradio-slider {
|
| 82 |
-
margin-bottom: 10px;
|
| 83 |
-
}
|
| 84 |
-
|
| 85 |
-
.gradio-button {
|
| 86 |
-
background-color: #00796b;
|
| 87 |
-
color: white;
|
| 88 |
-
font-weight: bold;
|
| 89 |
-
border-radius: 5px;
|
| 90 |
-
transition: background-color 0.3s ease;
|
| 91 |
-
}
|
| 92 |
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
}
|
| 96 |
-
|
| 97 |
-
.gradio-chat-message {
|
| 98 |
-
font-size: 16px;
|
| 99 |
-
border-radius: 5px;
|
| 100 |
-
background-color: #ffffff;
|
| 101 |
-
padding: 10px;
|
| 102 |
-
margin-bottom: 5px;
|
| 103 |
-
}
|
| 104 |
-
|
| 105 |
-
.gradio-chat-message-user {
|
| 106 |
-
background-color: #00796b;
|
| 107 |
-
color: white;
|
| 108 |
-
}
|
| 109 |
-
|
| 110 |
-
.gradio-chat-message-assistant {
|
| 111 |
-
background-color: #e0f7fa;
|
| 112 |
-
color: black;
|
| 113 |
-
}
|
| 114 |
-
"""
|
| 115 |
-
)
|
|
|
|
| 2 |
from huggingface_hub import InferenceClient
|
| 3 |
|
| 4 |
"""
|
| 5 |
+
For more information on huggingface_hub Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
| 6 |
"""
|
| 7 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
| 8 |
|
|
|
|
| 43 |
"""
|
| 44 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
| 45 |
"""
|
| 46 |
+
demo = gr.ChatInterface(
|
| 47 |
+
respond,
|
| 48 |
+
additional_inputs=[
|
| 49 |
+
gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
|
| 50 |
+
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
| 51 |
+
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
| 52 |
+
gr.Slider(
|
| 53 |
+
minimum=0.1,
|
| 54 |
+
maximum=1.0,
|
| 55 |
+
value=0.95,
|
| 56 |
+
step=0.05,
|
| 57 |
+
label="Top-p (nucleus sampling)",
|
| 58 |
+
),
|
| 59 |
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
)
|
| 61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
|
| 63 |
+
if __name__ == "__main__":
|
| 64 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|