Spaces:
Runtime error
Runtime error
Removing flask
Browse files- app.py +5 -1
- app_flask.py +0 -71
- requirements.txt +2 -7
- static/chatbot.js +0 -110
- static/style.css +0 -217
- templates/index.html +0 -31
app.py
CHANGED
|
@@ -58,15 +58,19 @@ with gr.Blocks() as demo:
|
|
| 58 |
).style(container=False)
|
| 59 |
|
| 60 |
with gr.Column(scale=0.15):
|
| 61 |
-
audio = gr.Audio(source="microphone", type="filepath")
|
| 62 |
|
| 63 |
txt.submit(add_text, [chatbot, txt], [chatbot, txt], postprocess=False).then(
|
| 64 |
bot, chatbot, chatbot
|
| 65 |
)
|
| 66 |
|
|
|
|
|
|
|
| 67 |
audio.change(fn=get_output, inputs=[chatbot, audio], outputs=[chatbot]).then(
|
| 68 |
bot, chatbot, chatbot
|
| 69 |
)
|
| 70 |
|
|
|
|
|
|
|
| 71 |
if __name__ == "__main__":
|
| 72 |
demo.launch()
|
|
|
|
| 58 |
).style(container=False)
|
| 59 |
|
| 60 |
with gr.Column(scale=0.15):
|
| 61 |
+
audio = gr.Audio(source="microphone", type="filepath")
|
| 62 |
|
| 63 |
txt.submit(add_text, [chatbot, txt], [chatbot, txt], postprocess=False).then(
|
| 64 |
bot, chatbot, chatbot
|
| 65 |
)
|
| 66 |
|
| 67 |
+
print(audio)
|
| 68 |
+
|
| 69 |
audio.change(fn=get_output, inputs=[chatbot, audio], outputs=[chatbot]).then(
|
| 70 |
bot, chatbot, chatbot
|
| 71 |
)
|
| 72 |
|
| 73 |
+
audio.change(lambda:None, None, audio)
|
| 74 |
+
|
| 75 |
if __name__ == "__main__":
|
| 76 |
demo.launch()
|
app_flask.py
DELETED
|
@@ -1,71 +0,0 @@
|
|
| 1 |
-
import os.path
|
| 2 |
-
import traceback
|
| 3 |
-
|
| 4 |
-
from flask import Flask, render_template, request
|
| 5 |
-
from flask_cors import CORS
|
| 6 |
-
from flask_executor import Executor
|
| 7 |
-
from flask_socketio import SocketIO, emit
|
| 8 |
-
from gevent import monkey
|
| 9 |
-
from utils import get_search_index
|
| 10 |
-
from scipy.io import wavfile
|
| 11 |
-
import base64, io
|
| 12 |
-
import numpy as np
|
| 13 |
-
import whisper
|
| 14 |
-
from main import run
|
| 15 |
-
|
| 16 |
-
monkey.patch_all(ssl=False)
|
| 17 |
-
|
| 18 |
-
app = Flask(__name__)
|
| 19 |
-
app.config['SECRET_KEY'] = 'secret!'
|
| 20 |
-
|
| 21 |
-
socketio = SocketIO(app, cors_allowed_origins="*", logger=True)
|
| 22 |
-
# cors = CORS(app)
|
| 23 |
-
executor = Executor(app)
|
| 24 |
-
|
| 25 |
-
executor.init_app(app)
|
| 26 |
-
app.config['EXECUTOR_MAX_WORKERS'] = 5
|
| 27 |
-
|
| 28 |
-
model = whisper.load_model('small.en')
|
| 29 |
-
|
| 30 |
-
@app.route('/')
|
| 31 |
-
def index():
|
| 32 |
-
get_search_index()
|
| 33 |
-
return render_template('index.html')
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
@socketio.on('message')
|
| 37 |
-
def handle_message(data):
|
| 38 |
-
question = data['question']
|
| 39 |
-
print("question: " + question)
|
| 40 |
-
|
| 41 |
-
if executor.futures:
|
| 42 |
-
emit('response', {'response': 'Server is busy, please try again later'})
|
| 43 |
-
return
|
| 44 |
-
|
| 45 |
-
try:
|
| 46 |
-
future = executor.submit(run, question)
|
| 47 |
-
response = future.result()
|
| 48 |
-
emit('response', {'response': response})
|
| 49 |
-
except Exception as e:
|
| 50 |
-
traceback.print_exc()
|
| 51 |
-
# print(f"Error processing request: {str(e)}")
|
| 52 |
-
emit('response', {'response': 'Server is busy. Please try again later.'})
|
| 53 |
-
|
| 54 |
-
@app.route('/audio', methods=['POST'])
|
| 55 |
-
def handle_audio():
|
| 56 |
-
# print the request files and names
|
| 57 |
-
print(request.files)
|
| 58 |
-
audio_data = request.files['audio']
|
| 59 |
-
audio_data.save('audio.webm')
|
| 60 |
-
print("audio data received: " + str(audio_data))
|
| 61 |
-
|
| 62 |
-
if os.path.isfile('audio.webm'):
|
| 63 |
-
print("audio file exists")
|
| 64 |
-
# Transcribe the audio data using OpenAI Whisper
|
| 65 |
-
transcript = whisper.transcribe(model, 'audio.webm')
|
| 66 |
-
data = {'question': transcript['text']}
|
| 67 |
-
handle_message(data)
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
if __name__ == '__main__':
|
| 71 |
-
socketio.run(app, port=5001)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
requirements.txt
CHANGED
|
@@ -1,15 +1,10 @@
|
|
| 1 |
langchain==0.0.131
|
| 2 |
openai==0.27.2
|
| 3 |
faiss-cpu==1.7.3
|
| 4 |
-
flask==2.2.3
|
| 5 |
-
flask-socketio==5.3.3
|
| 6 |
-
flask-executor==1.0.0
|
| 7 |
-
gevent==22.10.2
|
| 8 |
-
gevent-websocket==0.10.1
|
| 9 |
unstructured==0.5.8
|
| 10 |
-
flask-cors==3.0.10
|
| 11 |
gradio
|
| 12 |
ffmpeg-python
|
| 13 |
transformers
|
| 14 |
gtts
|
| 15 |
-
torch
|
|
|
|
|
|
| 1 |
langchain==0.0.131
|
| 2 |
openai==0.27.2
|
| 3 |
faiss-cpu==1.7.3
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
unstructured==0.5.8
|
|
|
|
| 5 |
gradio
|
| 6 |
ffmpeg-python
|
| 7 |
transformers
|
| 8 |
gtts
|
| 9 |
+
torch
|
| 10 |
+
tensorflow
|
static/chatbot.js
DELETED
|
@@ -1,110 +0,0 @@
|
|
| 1 |
-
$(document).ready(function() {
|
| 2 |
-
// Initialize variables
|
| 3 |
-
var $chatContainer = $('.chat-container');
|
| 4 |
-
var $chatHeader = $('.chat-header');
|
| 5 |
-
var $chatBody = $('.chat-body');
|
| 6 |
-
var $chatInput = $('.chat-input');
|
| 7 |
-
var $input = $('.chat-input input');
|
| 8 |
-
var $submit = $('.chat_submit');
|
| 9 |
-
var session_id = '';
|
| 10 |
-
$chatBody.children().each(function() {
|
| 11 |
-
$(this).addClass('chat-message');
|
| 12 |
-
});
|
| 13 |
-
|
| 14 |
-
// Initialize SocketIO connection
|
| 15 |
-
var socket = io.connect('https://' + document.domain + ':' + location.port);
|
| 16 |
-
|
| 17 |
-
// Function to send message to Flask-SocketIO app
|
| 18 |
-
function sendMessage(message) {
|
| 19 |
-
console.log("message: " + message )
|
| 20 |
-
socket.emit('message', {'question': message});
|
| 21 |
-
}
|
| 22 |
-
|
| 23 |
-
// Function to display message
|
| 24 |
-
function displayMessage(message, isUser, hasHtml) {
|
| 25 |
-
var $message = $('<div>').addClass('chat-message round');
|
| 26 |
-
var $messageText
|
| 27 |
-
if (hasHtml) {
|
| 28 |
-
$messageText = $('<p>').html(message);
|
| 29 |
-
} else {
|
| 30 |
-
$messageText = $('<p>').html(message.replace(/(https?:\/\/[^\s]+)/g, '<a href="$1">$1</a>').replace(/(SOURCES:)/, '<br>$1'));
|
| 31 |
-
}
|
| 32 |
-
|
| 33 |
-
$message.append($messageText);
|
| 34 |
-
if (isUser) {
|
| 35 |
-
$message.addClass('user');
|
| 36 |
-
} else {
|
| 37 |
-
$message.addClass('bot')
|
| 38 |
-
}
|
| 39 |
-
if ($chatBody) {
|
| 40 |
-
$chatBody.append($message);
|
| 41 |
-
if ($chatBody[0]) {
|
| 42 |
-
$chatBody.animate({scrollTop: $chatBody[0].scrollHeight}, 300);
|
| 43 |
-
}
|
| 44 |
-
} else {
|
| 45 |
-
$('.chat-container').append($message);
|
| 46 |
-
$('.chat-container').animate({scrollTop: 0}, 300);
|
| 47 |
-
}
|
| 48 |
-
}
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
socket.on('response', function(data) {
|
| 52 |
-
console.log("Received response: " + data.response)
|
| 53 |
-
var response = data.response;
|
| 54 |
-
displayMessage(response, false);
|
| 55 |
-
});
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
// Send message on submit
|
| 59 |
-
$submit.click(function(event) {
|
| 60 |
-
event.preventDefault();
|
| 61 |
-
var message = $input.val().trim();
|
| 62 |
-
console.log("Submit clicked: " + message)
|
| 63 |
-
if (message !== '') {
|
| 64 |
-
displayMessage(message, true);
|
| 65 |
-
sendMessage(message);
|
| 66 |
-
$input.val('');
|
| 67 |
-
}
|
| 68 |
-
});
|
| 69 |
-
|
| 70 |
-
// Send message on enter key press
|
| 71 |
-
$input.keydown(function(event) {
|
| 72 |
-
if (event.keyCode === 13) {
|
| 73 |
-
event.preventDefault();
|
| 74 |
-
$submit.click();
|
| 75 |
-
}
|
| 76 |
-
});
|
| 77 |
-
|
| 78 |
-
// Initial message
|
| 79 |
-
displayMessage('Learn about <a href="https://www.coursera.org/learn/3d-printing-revolution/home">3D printing Revolution</a> course with referred sources', false, true);
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
// Function to minimize the widget
|
| 83 |
-
function minimizeWidget() {
|
| 84 |
-
$chatContainer.addClass('minimized');
|
| 85 |
-
$chatHeader.hide();
|
| 86 |
-
$chatBody.hide()
|
| 87 |
-
$chatInput.hide();
|
| 88 |
-
$chatContainer.append('<div class="chat-bot-icon"><i class="fa fa-android"></i></div>');
|
| 89 |
-
}
|
| 90 |
-
|
| 91 |
-
// Function to maximize the widget
|
| 92 |
-
function maximizeWidget() {
|
| 93 |
-
$chatContainer.removeClass('minimized');
|
| 94 |
-
$chatBody.show()
|
| 95 |
-
$chatHeader.show();
|
| 96 |
-
$chatInput.show();
|
| 97 |
-
$('.chat-bot-icon').remove();
|
| 98 |
-
}
|
| 99 |
-
|
| 100 |
-
// Minimize the widget on click of close button
|
| 101 |
-
$chatHeader.find('.chat-close').click(function() {
|
| 102 |
-
minimizeWidget();
|
| 103 |
-
});
|
| 104 |
-
|
| 105 |
-
// Maximize the widget on click of chat-bot-icon
|
| 106 |
-
$chatContainer.on('click', '.chat-bot-icon', function() {
|
| 107 |
-
maximizeWidget();
|
| 108 |
-
});
|
| 109 |
-
|
| 110 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static/style.css
DELETED
|
@@ -1,217 +0,0 @@
|
|
| 1 |
-
.chat-container {
|
| 2 |
-
position: fixed;
|
| 3 |
-
width:98%;
|
| 4 |
-
height:90%;
|
| 5 |
-
bottom: 30px;
|
| 6 |
-
right: 30px;
|
| 7 |
-
z-index: 999;
|
| 8 |
-
background-color: #fff;
|
| 9 |
-
border-radius: 10px;
|
| 10 |
-
box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.2);
|
| 11 |
-
/*max-width: 400px;*/
|
| 12 |
-
min-width: 300px;
|
| 13 |
-
}
|
| 14 |
-
|
| 15 |
-
.round {
|
| 16 |
-
border-radius: 10px;
|
| 17 |
-
-webkit-border-radius: 10px;
|
| 18 |
-
-moz-border-radius: 30px;
|
| 19 |
-
|
| 20 |
-
}
|
| 21 |
-
|
| 22 |
-
.chat-header {
|
| 23 |
-
display: flex;
|
| 24 |
-
align-items: center;
|
| 25 |
-
justify-content: space-between;
|
| 26 |
-
padding: 10px;
|
| 27 |
-
background-color: darkblue;
|
| 28 |
-
color: #fff;
|
| 29 |
-
border-top-left-radius: 10px;
|
| 30 |
-
border-top-right-radius: 10px;
|
| 31 |
-
}
|
| 32 |
-
|
| 33 |
-
.chat-header h4 {
|
| 34 |
-
margin: 0;
|
| 35 |
-
}
|
| 36 |
-
|
| 37 |
-
.chat-close {
|
| 38 |
-
cursor: pointer;
|
| 39 |
-
}
|
| 40 |
-
|
| 41 |
-
.chat-body {
|
| 42 |
-
height: 300px;
|
| 43 |
-
overflow-y: scroll;
|
| 44 |
-
padding: 10px;
|
| 45 |
-
word-wrap: break-word;
|
| 46 |
-
display:flex;
|
| 47 |
-
flex-direction: column;
|
| 48 |
-
}
|
| 49 |
-
|
| 50 |
-
.chat-message {
|
| 51 |
-
margin: 10px;
|
| 52 |
-
}
|
| 53 |
-
|
| 54 |
-
.chat-message p {
|
| 55 |
-
margin: 0;
|
| 56 |
-
padding: 10px;
|
| 57 |
-
font-size: 16px;
|
| 58 |
-
line-height: 1.4;
|
| 59 |
-
position: relative;
|
| 60 |
-
word-wrap: break-word;
|
| 61 |
-
border-radius: 10px;
|
| 62 |
-
color: #fff;
|
| 63 |
-
}
|
| 64 |
-
|
| 65 |
-
.chat-message.user {
|
| 66 |
-
display: flex;
|
| 67 |
-
align-self: flex-end;
|
| 68 |
-
justify-content: flex-end;
|
| 69 |
-
text-align: right;
|
| 70 |
-
align-items: center;
|
| 71 |
-
background-color: rgba(0, 0, 139, 0.75);
|
| 72 |
-
border-top-right-radius: 0px;
|
| 73 |
-
border-bottom-right-radius: 0px;
|
| 74 |
-
border-bottom-left-radius: 10px;
|
| 75 |
-
word-wrap: break-word;
|
| 76 |
-
}
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
.chat-message.bot {
|
| 80 |
-
display: flex;
|
| 81 |
-
align-self: flex-start;
|
| 82 |
-
justify-content: flex-start;
|
| 83 |
-
text-align: left;
|
| 84 |
-
align-items: center;
|
| 85 |
-
background-color: rgba(0, 0, 139, 0.75);
|
| 86 |
-
border-top-left-radius: 0px;
|
| 87 |
-
border-bottom-right-radius: 10px;
|
| 88 |
-
border-bottom-left-radius: 0px;
|
| 89 |
-
word-wrap: break-word;
|
| 90 |
-
}
|
| 91 |
-
|
| 92 |
-
.chat-message.bot p {
|
| 93 |
-
margin: 0;
|
| 94 |
-
padding: 10px;
|
| 95 |
-
font-size: 16px;
|
| 96 |
-
line-height: 1.4;
|
| 97 |
-
position: relative;
|
| 98 |
-
word-wrap: break-word;
|
| 99 |
-
border-radius: 10px;
|
| 100 |
-
overflow-wrap: anywhere;
|
| 101 |
-
}
|
| 102 |
-
|
| 103 |
-
.chat-message.user:after {
|
| 104 |
-
content: "";
|
| 105 |
-
position: relative;
|
| 106 |
-
top: 0;
|
| 107 |
-
right: -15px;
|
| 108 |
-
width: 0;
|
| 109 |
-
height: 0;
|
| 110 |
-
border-top: 15px solid transparent;
|
| 111 |
-
border-bottom: 15px solid transparent;
|
| 112 |
-
border-left: 16px solid #00008BBF;
|
| 113 |
-
border-top-right-radius: 10px;
|
| 114 |
-
}
|
| 115 |
-
|
| 116 |
-
.chat-message.bot:before {
|
| 117 |
-
content: "";
|
| 118 |
-
position: relative;
|
| 119 |
-
top: 0;
|
| 120 |
-
left: -15px;
|
| 121 |
-
width: 0;
|
| 122 |
-
height: 0;
|
| 123 |
-
border-top: 15px solid transparent;
|
| 124 |
-
border-bottom: 15px solid transparent;
|
| 125 |
-
border-right: 15px solid #00008BBF;
|
| 126 |
-
border-top-left-radius: 10px;
|
| 127 |
-
}
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
.chat-input {
|
| 131 |
-
display: flex;
|
| 132 |
-
position: absolute;
|
| 133 |
-
bottom: 0;
|
| 134 |
-
left: 0;
|
| 135 |
-
right: 0;
|
| 136 |
-
}
|
| 137 |
-
|
| 138 |
-
.chat-input input {
|
| 139 |
-
flex-grow: 1;
|
| 140 |
-
border: none;
|
| 141 |
-
border-radius: 5px;
|
| 142 |
-
padding: 8px 10px;
|
| 143 |
-
font-size: 16px;
|
| 144 |
-
margin-right: 10px;
|
| 145 |
-
box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.1);
|
| 146 |
-
}
|
| 147 |
-
|
| 148 |
-
.chat-input button {
|
| 149 |
-
background-color: #00008BBF;
|
| 150 |
-
color: #fff;
|
| 151 |
-
border: none;
|
| 152 |
-
border-radius: 5px;
|
| 153 |
-
padding: 8px 10px;
|
| 154 |
-
font-size: 16px;
|
| 155 |
-
cursor: pointer;
|
| 156 |
-
box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.1);
|
| 157 |
-
}
|
| 158 |
-
|
| 159 |
-
/* CSS for chat-container when minimized */
|
| 160 |
-
.chat-container.minimized {
|
| 161 |
-
min-width: 70px;
|
| 162 |
-
width: 70px;
|
| 163 |
-
height: 70px;
|
| 164 |
-
border-radius: 50%;
|
| 165 |
-
position: fixed;
|
| 166 |
-
bottom: 10px;
|
| 167 |
-
right: 10px;
|
| 168 |
-
z-index: 9999;
|
| 169 |
-
background-color: #fff;
|
| 170 |
-
box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.3);
|
| 171 |
-
cursor: pointer;
|
| 172 |
-
}
|
| 173 |
-
|
| 174 |
-
/* CSS for chat-bot-icon */
|
| 175 |
-
.chat-bot-icon {
|
| 176 |
-
font-size: 30px;
|
| 177 |
-
color: #00008BBF;
|
| 178 |
-
position: absolute;
|
| 179 |
-
top: 50%;
|
| 180 |
-
left: 50%;
|
| 181 |
-
transform: translate(-50%, -50%);
|
| 182 |
-
}
|
| 183 |
-
|
| 184 |
-
/* CSS for chat-header when not minimized */
|
| 185 |
-
.chat-header {
|
| 186 |
-
display: flex;
|
| 187 |
-
justify-content: space-between;
|
| 188 |
-
align-items: center;
|
| 189 |
-
background-color: #6c7ae0;
|
| 190 |
-
color: #fff;
|
| 191 |
-
padding: 10px;
|
| 192 |
-
border-top-left-radius: 5px;
|
| 193 |
-
border-top-right-radius: 5px;
|
| 194 |
-
}
|
| 195 |
-
|
| 196 |
-
/* CSS for chat-container when not minimized */
|
| 197 |
-
.chat-container:not(.minimized) {
|
| 198 |
-
border-radius: 5px;
|
| 199 |
-
position: fixed;
|
| 200 |
-
bottom: 10px;
|
| 201 |
-
right: 10px;
|
| 202 |
-
z-index: 9999;
|
| 203 |
-
background-color: #fff;
|
| 204 |
-
box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.3);
|
| 205 |
-
}
|
| 206 |
-
|
| 207 |
-
/* CSS for chat-bot-icon when chat-container is minimized */
|
| 208 |
-
.chat-container.minimized .chat-bot-icon {
|
| 209 |
-
display: block;
|
| 210 |
-
}
|
| 211 |
-
|
| 212 |
-
/* CSS for chat-bot-icon when chat-container is not minimized */
|
| 213 |
-
.chat-container:not(.minimized) .chat-bot-icon {
|
| 214 |
-
display: none;
|
| 215 |
-
}
|
| 216 |
-
|
| 217 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
templates/index.html
DELETED
|
@@ -1,31 +0,0 @@
|
|
| 1 |
-
<!DOCTYPE html>
|
| 2 |
-
<html>
|
| 3 |
-
<head>
|
| 4 |
-
<meta charset="utf-8">
|
| 5 |
-
<title>Coursera QA Bot</title>
|
| 6 |
-
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
|
| 7 |
-
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
|
| 8 |
-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
|
| 9 |
-
<link rel="stylesheet" href="static/style.css">
|
| 10 |
-
</head>
|
| 11 |
-
<body>
|
| 12 |
-
<div class="chat-container">
|
| 13 |
-
<div class="chat-header">
|
| 14 |
-
<h4>Coursera Assistant</h4>
|
| 15 |
-
<i class="fa fa-close chat-close"></i>
|
| 16 |
-
</div>
|
| 17 |
-
<div class="chat-bot-icon">
|
| 18 |
-
<i class="fa fa-android"></i> <!-- Replace with your bot icon -->
|
| 19 |
-
</div>
|
| 20 |
-
<div class="chat-body chat-messages round"></div>
|
| 21 |
-
<div class="chat-input">
|
| 22 |
-
<input type="text" placeholder="Type your message">
|
| 23 |
-
<button class="chat_submit">Send</button>
|
| 24 |
-
</div>
|
| 25 |
-
</div>
|
| 26 |
-
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.5.1/socket.io.js" integrity="sha512-sY2t8W1xNQ2yB+1RFXJv+wwhdN7CHX9Z+fhM7JH/3B3q1x7VJBOwKe+zb7VW0EC8XG5M5rjBQd7+47F5fQlhKQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>-->
|
| 27 |
-
<script src="https://cdn.socket.io/4.4.1/socket.io.min.js"></script>
|
| 28 |
-
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
| 29 |
-
<script src="static/chatbot.js"></script>
|
| 30 |
-
</body>
|
| 31 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|