Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -53,10 +53,13 @@ with gr.Blocks() as demo:
|
|
53 |
inputs=[session_id],
|
54 |
outputs=[chatbot, emotion_out, score_out])
|
55 |
|
56 |
-
# ------------------ API Endpoint
|
57 |
-
|
58 |
-
|
59 |
-
|
|
|
|
|
60 |
|
61 |
-
#
|
62 |
-
demo.launch(share=True, server_name="0.0.0.0", server_port=7860)
|
|
|
|
53 |
inputs=[session_id],
|
54 |
outputs=[chatbot, emotion_out, score_out])
|
55 |
|
56 |
+
# ------------------ API Endpoint ------------------
|
57 |
+
api_interface = gr.Interface(
|
58 |
+
fn=chatbot_response, # Exposing the chatbot function
|
59 |
+
inputs=[gr.Textbox(label="Message"), gr.Textbox(label="Session ID", value="default")],
|
60 |
+
outputs=[gr.Textbox(label="Chatbot Response"), gr.Textbox(label="Detected Emotion"), gr.Number(label="Confidence Score")]
|
61 |
+
)
|
62 |
|
63 |
+
# Launch Gradio interface and API
|
64 |
+
demo.launch(share=True, server_name="0.0.0.0", server_port=7860)
|
65 |
+
api_interface.launch(share=True, server_name="0.0.0.0", server_port=7861)
|