Spaces:
Sleeping
Sleeping
Commit
·
61d37c6
1
Parent(s):
4574d7c
updated
Browse files
app.py
CHANGED
|
@@ -1,26 +1,21 @@
|
|
| 1 |
-
# app.py at the root
|
| 2 |
import gradio as gr
|
| 3 |
-
import
|
| 4 |
-
from src.preprocess import clean_text
|
| 5 |
|
| 6 |
-
#
|
| 7 |
-
|
| 8 |
-
responses = joblib.load("models/responses.joblib")
|
| 9 |
|
| 10 |
-
def
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
|
|
|
| 15 |
|
| 16 |
-
# Gradio
|
| 17 |
-
demo = gr.
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
title="LMS Chatbot",
|
| 22 |
-
description="Ask anything about LMS and get automated responses."
|
| 23 |
-
)
|
| 24 |
|
| 25 |
-
|
| 26 |
-
demo.launch()
|
|
|
|
| 1 |
+
# app.py at the root
|
| 2 |
import gradio as gr
|
| 3 |
+
from src.predict import chatbot_response
|
|
|
|
| 4 |
|
| 5 |
+
# Keep conversation history
|
| 6 |
+
history = []
|
|
|
|
| 7 |
|
| 8 |
+
def chat(user_input):
|
| 9 |
+
global history
|
| 10 |
+
response = chatbot_response(user_input)
|
| 11 |
+
history.append(("You", user_input))
|
| 12 |
+
history.append(("Bot", response))
|
| 13 |
+
return history, history
|
| 14 |
|
| 15 |
+
# Gradio Chat Interface
|
| 16 |
+
demo = gr.ChatInterface(fn=chat,
|
| 17 |
+
title="LMS Chatbot",
|
| 18 |
+
description="Chat with the LMS Chatbot",
|
| 19 |
+
height=600)
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
+
demo.launch()
|
|
|