Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,15 @@
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
from rasa.core.agent import Agent
|
3 |
import asyncio
|
4 |
|
5 |
-
# Load trained Rasa model
|
6 |
-
|
|
|
|
|
|
|
|
|
7 |
|
8 |
async def chat_with_bot(message):
|
9 |
response = await agent.handle_text(message)
|
|
|
1 |
+
|
2 |
+
|
3 |
import gradio as gr
|
4 |
from rasa.core.agent import Agent
|
5 |
import asyncio
|
6 |
|
7 |
+
# Load the trained Rasa model
|
8 |
+
async def load_agent():
|
9 |
+
return await Agent.load("models") # Ensure models folder has trained files
|
10 |
+
|
11 |
+
# Use asyncio to load the agent
|
12 |
+
agent = asyncio.run(load_agent())
|
13 |
|
14 |
async def chat_with_bot(message):
|
15 |
response = await agent.handle_text(message)
|