Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,6 +6,11 @@ import requests
|
|
| 6 |
import json
|
| 7 |
import threading
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
# Start Rasa server in the background
|
| 10 |
def start_rasa_server():
|
| 11 |
subprocess.Popen(["rasa", "run", "--enable-api", "--cors", "*", "--port", "5005"])
|
|
@@ -34,13 +39,14 @@ def chat_with_rasa(message, history):
|
|
| 34 |
return f"Error: {str(e)}"
|
| 35 |
|
| 36 |
# Create Gradio interface
|
| 37 |
-
chatbot = gr.Chatbot(title
|
| 38 |
interface = gr.Interface(
|
| 39 |
fn=chat_with_rasa,
|
| 40 |
inputs=gr.Textbox(placeholder="Type your message here..."),
|
| 41 |
outputs="text",
|
| 42 |
title="Rasa Chatbot",
|
| 43 |
-
description="Chat with your Rasa assistant"
|
|
|
|
| 44 |
)
|
| 45 |
|
| 46 |
# Launch the interface
|
|
|
|
| 6 |
import json
|
| 7 |
import threading
|
| 8 |
|
| 9 |
+
# Set environment variables to fix permission issues
|
| 10 |
+
os.environ["MPLCONFIGDIR"] = "/tmp/matplotlib"
|
| 11 |
+
os.environ["RASA_USER_HOME"] = "/tmp/rasa"
|
| 12 |
+
os.environ["SQLALCHEMY_SILENCE_UBER_WARNING"] = "1"
|
| 13 |
+
|
| 14 |
# Start Rasa server in the background
|
| 15 |
def start_rasa_server():
|
| 16 |
subprocess.Popen(["rasa", "run", "--enable-api", "--cors", "*", "--port", "5005"])
|
|
|
|
| 39 |
return f"Error: {str(e)}"
|
| 40 |
|
| 41 |
# Create Gradio interface
|
| 42 |
+
chatbot = gr.Chatbot() # Removed title parameter which is not supported
|
| 43 |
interface = gr.Interface(
|
| 44 |
fn=chat_with_rasa,
|
| 45 |
inputs=gr.Textbox(placeholder="Type your message here..."),
|
| 46 |
outputs="text",
|
| 47 |
title="Rasa Chatbot",
|
| 48 |
+
description="Chat with your Rasa assistant",
|
| 49 |
+
flagging_dir="/tmp/flagged" # Use a writable directory for flagging
|
| 50 |
)
|
| 51 |
|
| 52 |
# Launch the interface
|