Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import InferenceClient
|
|
|
3 |
|
4 |
# Hugging Face inference client
|
5 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
@@ -27,18 +28,53 @@ def respond(message, history, system_message, max_tokens, temperature, top_p):
|
|
27 |
response += token
|
28 |
yield response
|
29 |
|
30 |
-
#
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
gr.Markdown("""
|
40 |
<h1 style='text-align: center; color: #FFFFFF;'>💬 AI Chat Assistant</h1>
|
41 |
-
<p style='text-align: center;'>
|
42 |
""")
|
43 |
|
44 |
with gr.Row():
|
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import InferenceClient
|
3 |
+
import uuid
|
4 |
|
5 |
# Hugging Face inference client
|
6 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
|
|
28 |
response += token
|
29 |
yield response
|
30 |
|
31 |
+
# ChatGPT-style UI with modern styling
|
32 |
+
css = """
|
33 |
+
.gradio-container {
|
34 |
+
max-width: 900px;
|
35 |
+
margin: auto;
|
36 |
+
background-color: #121212;
|
37 |
+
color: white;
|
38 |
+
}
|
39 |
+
.chat-container {
|
40 |
+
display: flex;
|
41 |
+
flex-direction: column;
|
42 |
+
height: 85vh;
|
43 |
+
overflow: hidden;
|
44 |
+
padding: 20px;
|
45 |
+
border-radius: 10px;
|
46 |
+
background: #1E1E1E;
|
47 |
+
}
|
48 |
+
.chat-message {
|
49 |
+
max-width: 75%;
|
50 |
+
padding: 10px;
|
51 |
+
margin-bottom: 10px;
|
52 |
+
border-radius: 10px;
|
53 |
+
font-size: 16px;
|
54 |
+
}
|
55 |
+
.user-message {
|
56 |
+
background-color: #007AFF;
|
57 |
+
align-self: flex-end;
|
58 |
+
color: white;
|
59 |
+
}
|
60 |
+
.bot-message {
|
61 |
+
background-color: #333;
|
62 |
+
align-self: flex-start;
|
63 |
+
}
|
64 |
+
.input-box {
|
65 |
+
background: #333;
|
66 |
+
border: none;
|
67 |
+
color: white;
|
68 |
+
border-radius: 8px;
|
69 |
+
padding: 10px;
|
70 |
+
font-size: 16px;
|
71 |
+
}
|
72 |
+
"""
|
73 |
+
|
74 |
+
with gr.Blocks(css=css) as demo:
|
75 |
gr.Markdown("""
|
76 |
<h1 style='text-align: center; color: #FFFFFF;'>💬 AI Chat Assistant</h1>
|
77 |
+
<p style='text-align: center;'>A sleek and interactive chatbot experience.</p>
|
78 |
""")
|
79 |
|
80 |
with gr.Row():
|