Spaces:
Running
Running
Update app.py (#4)
Browse files- Update app.py (8680e2f454e7da5ae2c852cedc524a6a034b552e)
Co-authored-by: nadia elghouti <[email protected]>
app.py
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
-
|
2 |
import gradio as gr
|
3 |
from huggingface_hub import InferenceClient
|
4 |
|
@@ -44,8 +43,7 @@ def respond(
|
|
44 |
"""
|
45 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
46 |
"""
|
47 |
-
|
48 |
-
app = gr.ChatInterface(
|
49 |
respond,
|
50 |
additional_inputs=[
|
51 |
gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
|
@@ -59,17 +57,8 @@ app = gr.ChatInterface(
|
|
59 |
label="Top-p (nucleus sampling)",
|
60 |
),
|
61 |
],
|
62 |
-
).queue()
|
63 |
-
|
64 |
-
# Add CORS middleware for WebSocket compatibility
|
65 |
-
app.server.add_middleware(
|
66 |
-
CORSMiddleware,
|
67 |
-
allow_origins=["*"],
|
68 |
-
allow_methods=["*"],
|
69 |
-
allow_headers=["*"],
|
70 |
-
expose_headers=["*"]
|
71 |
)
|
72 |
|
73 |
-
|
74 |
if __name__ == "__main__":
|
75 |
-
|
|
|
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import InferenceClient
|
3 |
|
|
|
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"),
|
|
|
57 |
label="Top-p (nucleus sampling)",
|
58 |
),
|
59 |
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
)
|
61 |
|
62 |
+
|
63 |
if __name__ == "__main__":
|
64 |
+
demo.launch()
|