Spaces:
Runtime error
Runtime error
Threatthriver
commited on
Commit
•
3942997
1
Parent(s):
aea68a1
Update app.py
Browse files
app.py
CHANGED
@@ -58,28 +58,25 @@ def respond(
|
|
58 |
except Exception as e:
|
59 |
yield f"An error occurred: {str(e)}"
|
60 |
|
61 |
-
|
62 |
-
with
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
inputs=[message, chatbot, system_message, max_tokens, temperature, top_p],
|
81 |
-
outputs=[chatbot],
|
82 |
-
show_progress=True)
|
83 |
|
84 |
# Launch the Gradio interface
|
85 |
if __name__ == "__main__":
|
|
|
58 |
except Exception as e:
|
59 |
yield f"An error occurred: {str(e)}"
|
60 |
|
61 |
+
|
62 |
+
# Define the ChatInterface with additional input components for user customization
|
63 |
+
demo = gr.ChatInterface(
|
64 |
+
fn=respond,
|
65 |
+
additional_inputs=[
|
66 |
+
gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
|
67 |
+
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
68 |
+
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
69 |
+
gr.Slider(
|
70 |
+
minimum=0.1,
|
71 |
+
maximum=1.0,
|
72 |
+
value=0.95,
|
73 |
+
step=0.05,
|
74 |
+
label="Top-p (nucleus sampling)",
|
75 |
+
),
|
76 |
+
],
|
77 |
+
title="Chatbot Interface",
|
78 |
+
description="A customizable chatbot interface using Hugging Face's Inference API.",
|
79 |
+
)
|
|
|
|
|
|
|
80 |
|
81 |
# Launch the Gradio interface
|
82 |
if __name__ == "__main__":
|