Spaces:
Runtime error
Runtime error
Create chat_ui.py
Browse files- pages/chat_ui.py +17 -0
pages/chat_ui.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import os, sys
|
| 3 |
+
|
| 4 |
+
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
| 5 |
+
UTILS_DIR = os.path.join(BASE_DIR, "utils")
|
| 6 |
+
if UTILS_DIR not in sys.path:
|
| 7 |
+
sys.path.insert(0, UTILS_DIR)
|
| 8 |
+
|
| 9 |
+
from backend import run_llm
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def create_chat_interface():
|
| 13 |
+
def chat_fn(message, history):
|
| 14 |
+
reply = run_llm(message)
|
| 15 |
+
return reply
|
| 16 |
+
|
| 17 |
+
return gr.ChatInterface(chat_fn, title="Omniscient Chatbot")
|