Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,41 +1,25 @@
|
|
| 1 |
-
import
|
| 2 |
-
import tarfile
|
| 3 |
-
import os
|
| 4 |
-
from flask import Flask, send_from_directory
|
| 5 |
-
from rasa.core.agent import Agent
|
| 6 |
-
from rasa.core.interpreter import RasaNLUInterpreter
|
| 7 |
-
from rasa.utils.endpoints import EndpointConfig
|
| 8 |
-
from rasa.core.channels.socketio import SocketIOInput
|
| 9 |
|
| 10 |
-
#
|
| 11 |
-
|
| 12 |
-
extract_dir = 'extracted_model'
|
| 13 |
|
| 14 |
-
#
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
namespace=None
|
| 35 |
-
)
|
| 36 |
-
endpoint = EndpointConfig(url="http://localhost:5055/webhook")
|
| 37 |
-
agent.handle_channels([input_channel], 5005, serve_forever=True)
|
| 38 |
-
|
| 39 |
-
if __name__ == '__main__':
|
| 40 |
-
threading.Thread(target=run_rasa).start()
|
| 41 |
-
app.run(host='0.0.0.0', port=7860)
|
|
|
|
| 1 |
+
import streamlit as st
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
+
# Set the page title
|
| 4 |
+
st.set_page_config(page_title="Chatbot")
|
|
|
|
| 5 |
|
| 6 |
+
# Embed the HTML content
|
| 7 |
+
st.markdown("""
|
| 8 |
+
<!DOCTYPE html>
|
| 9 |
+
<html lang="en">
|
| 10 |
+
<body>
|
| 11 |
+
<script>
|
| 12 |
+
!(function () {
|
| 13 |
+
let e = document.createElement("script"),
|
| 14 |
+
t = document.head || document.getElementsByTagName("head")[0];
|
| 15 |
+
(e.src = "https://cdn.jsdelivr.net/npm/rasa-webchat@1.x.x/lib/index.js"),
|
| 16 |
+
// Replace 1.x.x with the version that you want
|
| 17 |
+
(e.async = !0),
|
| 18 |
+
(e.onload = () => {
|
| 19 |
+
window.WebChat.default(
|
| 20 |
+
{
|
| 21 |
+
initPayload: "/init_greet",
|
| 22 |
+
customData: { language: "en" },
|
| 23 |
+
socketUrl: "http://localhost:5005",
|
| 24 |
+
title: "Mybot",
|
| 25 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|