Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,12 +1,8 @@
|
|
| 1 |
import gradio as gr
|
| 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 |
|
| 9 |
-
|
| 10 |
def respond(
|
| 11 |
message,
|
| 12 |
history: list[tuple[str, str]],
|
|
@@ -39,12 +35,42 @@ def respond(
|
|
| 39 |
response += token
|
| 40 |
yield response
|
| 41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
"""
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
demo = gr.
|
| 46 |
-
respond,
|
| 47 |
-
|
| 48 |
gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
|
| 49 |
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
| 50 |
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
|
@@ -56,8 +82,8 @@ demo = gr.ChatInterface(
|
|
| 56 |
label="Top-p (nucleus sampling)",
|
| 57 |
),
|
| 58 |
],
|
|
|
|
| 59 |
)
|
| 60 |
|
| 61 |
-
|
| 62 |
if __name__ == "__main__":
|
| 63 |
-
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
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 |
response += token
|
| 36 |
yield response
|
| 37 |
|
| 38 |
+
# Define custom CSS
|
| 39 |
+
custom_css = """
|
| 40 |
+
/* Add your custom CSS styles here */
|
| 41 |
+
body {
|
| 42 |
+
font-family: Arial, sans-serif;
|
| 43 |
+
background-color: black;
|
| 44 |
+
}
|
| 45 |
+
.gradio-container {
|
| 46 |
+
border: 10px solid #4CAF50;
|
| 47 |
+
border-radius: 10px;
|
| 48 |
+
padding: 20px;
|
| 49 |
+
background-color: #ffffff;
|
| 50 |
+
}
|
| 51 |
+
.gradio-input {
|
| 52 |
+
border-radius: 5px;
|
| 53 |
+
border: 1px solid #ddd;
|
| 54 |
+
padding: 10px;
|
| 55 |
+
}
|
| 56 |
+
.gradio-button {
|
| 57 |
+
background-color: #4CAF50;
|
| 58 |
+
color: white;
|
| 59 |
+
border: none;
|
| 60 |
+
border-radius: 5px;
|
| 61 |
+
padding: 10px 20px;
|
| 62 |
+
}
|
| 63 |
+
.gradio-output {
|
| 64 |
+
border: 1px solid #ddd;
|
| 65 |
+
padding: 10px;
|
| 66 |
+
border-radius: 5px;
|
| 67 |
+
}
|
| 68 |
"""
|
| 69 |
+
|
| 70 |
+
# Create a Gradio interface with custom CSS
|
| 71 |
+
demo = gr.Interface(
|
| 72 |
+
fn=respond,
|
| 73 |
+
inputs=[
|
| 74 |
gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
|
| 75 |
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
| 76 |
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
|
|
|
| 82 |
label="Top-p (nucleus sampling)",
|
| 83 |
),
|
| 84 |
],
|
| 85 |
+
css=custom_css
|
| 86 |
)
|
| 87 |
|
|
|
|
| 88 |
if __name__ == "__main__":
|
| 89 |
+
demo.launch()
|