Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -127,9 +127,6 @@ For more information on `huggingface_hub` Inference API support, please check th
|
|
127 |
"""
|
128 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
129 |
|
130 |
-
|
131 |
-
import gradio as gr
|
132 |
-
|
133 |
def respond(
|
134 |
message,
|
135 |
history: list[tuple[str, str]],
|
@@ -162,11 +159,50 @@ def respond(
|
|
162 |
response += token
|
163 |
yield response
|
164 |
|
165 |
-
# Define a custom Gradio Chat Interface
|
166 |
with gr.Blocks() as demo:
|
167 |
gr.Markdown("### AI-Powered Customer Support Assistant")
|
168 |
|
169 |
-
chatbot = gr.ChatInterface(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
|
171 |
if __name__ == "__main__":
|
172 |
demo.launch()
|
|
|
127 |
"""
|
128 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
129 |
|
|
|
|
|
|
|
130 |
def respond(
|
131 |
message,
|
132 |
history: list[tuple[str, str]],
|
|
|
159 |
response += token
|
160 |
yield response
|
161 |
|
162 |
+
# Define a custom Gradio Chat Interface with hidden sliders
|
163 |
with gr.Blocks() as demo:
|
164 |
gr.Markdown("### AI-Powered Customer Support Assistant")
|
165 |
|
166 |
+
chatbot = gr.ChatInterface(
|
167 |
+
respond,
|
168 |
+
additional_inputs=[
|
169 |
+
gr.Textbox(
|
170 |
+
value="You are a friendly chatbot.",
|
171 |
+
label="System Message",
|
172 |
+
info="Customize how the assistant behaves in conversations."
|
173 |
+
),
|
174 |
+
gr.Slider(
|
175 |
+
minimum=1,
|
176 |
+
maximum=2048,
|
177 |
+
value=512,
|
178 |
+
step=1,
|
179 |
+
label="Max New Tokens",
|
180 |
+
visible=False
|
181 |
+
),
|
182 |
+
gr.Slider(
|
183 |
+
minimum=0.1,
|
184 |
+
maximum=4.0,
|
185 |
+
value=0.7,
|
186 |
+
step=0.1,
|
187 |
+
label="Temperature",
|
188 |
+
visible=False
|
189 |
+
),
|
190 |
+
gr.Slider(
|
191 |
+
minimum=0.1,
|
192 |
+
maximum=1.0,
|
193 |
+
value=0.95,
|
194 |
+
step=0.05,
|
195 |
+
label="Top-p (Nucleus Sampling)",
|
196 |
+
visible=False
|
197 |
+
),
|
198 |
+
]
|
199 |
+
)
|
200 |
+
|
201 |
+
gr.Markdown("### Instructions")
|
202 |
+
gr.Textbox(
|
203 |
+
value="Enter your query, select response settings, and start the conversation.",
|
204 |
+
interactive=False,
|
205 |
+
)
|
206 |
|
207 |
if __name__ == "__main__":
|
208 |
demo.launch()
|