Spaces:
Runtime error
Runtime error
add application files
Browse files- app.py +12 -1
- model/chat.py +4 -3
app.py
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from model.controller import Controller
|
| 3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
# Initialize your controller
|
| 5 |
bot = Controller()
|
| 6 |
|
|
@@ -13,7 +24,7 @@ with gr.Blocks() as interface:
|
|
| 13 |
gr.Markdown("## RAG Law Chatbot")
|
| 14 |
|
| 15 |
chatbot = gr.Chatbot()
|
| 16 |
-
user_input = gr.Textbox(show_label=False, placeholder="Enter your law question...")
|
| 17 |
send_button = gr.Button("Send")
|
| 18 |
|
| 19 |
def chat_update(user_message, history):
|
|
|
|
| 1 |
+
import os
|
| 2 |
import gradio as gr
|
| 3 |
from model.controller import Controller
|
| 4 |
|
| 5 |
+
# Change working directory to /home/user/app
|
| 6 |
+
os.chdir("/home/user/app")
|
| 7 |
+
|
| 8 |
+
# Download and prepare data files in the correct directory
|
| 9 |
+
os.system('wget -O processed_cases.csv "https://drive.usercontent.google.com/download?id=1jMuQtywo0mbj7ZHCCsyE8xurbSyVVCst&export=download&confirm=t&uuid=2f681c98-86f8-4159-9e03-673cdcbc7cb51"')
|
| 10 |
+
os.system('wget -O chromadb_collection.rar "https://drive.usercontent.google.com/download?id=1-3N-QjK6QMogy2mcNEKjTg_9yIrSjh4A&export=download&confirm=t&uuid=ceed27ad-0f81-4c16-b70f-68cebcc55279"')
|
| 11 |
+
os.system('unrar x chromadb_collection.rar')
|
| 12 |
+
os.system('mv content/chromadb_collections chromadb_collections')
|
| 13 |
+
os.system('rm -r content')
|
| 14 |
+
|
| 15 |
# Initialize your controller
|
| 16 |
bot = Controller()
|
| 17 |
|
|
|
|
| 24 |
gr.Markdown("## RAG Law Chatbot")
|
| 25 |
|
| 26 |
chatbot = gr.Chatbot()
|
| 27 |
+
user_input = gr.Textbox(show_label=False, placeholder="Enter your law question...")
|
| 28 |
send_button = gr.Button("Send")
|
| 29 |
|
| 30 |
def chat_update(user_message, history):
|
model/chat.py
CHANGED
|
@@ -17,7 +17,8 @@ class Chat:
|
|
| 17 |
|
| 18 |
info_list = self.rag_handler.get_information(message)
|
| 19 |
prompt = self.prompt_handler.get_prompt(message, info_list)
|
| 20 |
-
|
|
|
|
| 21 |
|
| 22 |
-
self.response_history.append(response)
|
| 23 |
-
return
|
|
|
|
| 17 |
|
| 18 |
info_list = self.rag_handler.get_information(message)
|
| 19 |
prompt = self.prompt_handler.get_prompt(message, info_list)
|
| 20 |
+
|
| 21 |
+
# response = self.llm.get_LLM_response(prompt=prompt)
|
| 22 |
|
| 23 |
+
# self.response_history.append(response)
|
| 24 |
+
return prompt
|