MEOW commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -27,7 +27,6 @@ from llama_index.readers.file import (
|
|
| 27 |
PptxReader,
|
| 28 |
CSVReader,
|
| 29 |
)
|
| 30 |
-
# os.makedirs('./data', exist_ok=True)
|
| 31 |
|
| 32 |
from llama_index.embeddings.nvidia import NVIDIAEmbedding
|
| 33 |
Settings.embed_model = NVIDIAEmbedding(model="NV-Embed-QA", truncate="END")
|
|
@@ -81,19 +80,6 @@ def load_documents(file_objs):
|
|
| 81 |
if not documents:
|
| 82 |
return f"No documents found in the selected files."
|
| 83 |
|
| 84 |
-
# Function to get file names from file objects
|
| 85 |
-
# def get_files_from_input(file_objs):
|
| 86 |
-
# if not file_objs:
|
| 87 |
-
# return []
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
# Load data using file extractor and SimpleDirectoryReader
|
| 91 |
-
# documents = SimpleDirectoryReader(
|
| 92 |
-
# input_dir="./data", recursive=True, file_extractor=file_extractor
|
| 93 |
-
# ).load_data()
|
| 94 |
-
|
| 95 |
-
# Get file names from documents
|
| 96 |
-
# return [doc.metadata['file_name'] for doc in documents]
|
| 97 |
|
| 98 |
# Create a Milvus vector store and storage context
|
| 99 |
# vector_store = MilvusVectorStore(
|
|
@@ -148,11 +134,11 @@ def stream_response(message,history):
|
|
| 148 |
|
| 149 |
# Create the Gradio interface
|
| 150 |
with gr.Blocks() as demo:
|
| 151 |
-
gr.Markdown("# RAG Chatbot")
|
| 152 |
|
| 153 |
with gr.Row():
|
| 154 |
file_input = gr.File(label="Select files to upload", file_count="multiple")
|
| 155 |
-
load_btn = gr.Button("Load
|
| 156 |
|
| 157 |
load_output = gr.Textbox(label="Load Status")
|
| 158 |
|
|
|
|
| 27 |
PptxReader,
|
| 28 |
CSVReader,
|
| 29 |
)
|
|
|
|
| 30 |
|
| 31 |
from llama_index.embeddings.nvidia import NVIDIAEmbedding
|
| 32 |
Settings.embed_model = NVIDIAEmbedding(model="NV-Embed-QA", truncate="END")
|
|
|
|
| 80 |
if not documents:
|
| 81 |
return f"No documents found in the selected files."
|
| 82 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
|
| 84 |
# Create a Milvus vector store and storage context
|
| 85 |
# vector_store = MilvusVectorStore(
|
|
|
|
| 134 |
|
| 135 |
# Create the Gradio interface
|
| 136 |
with gr.Blocks() as demo:
|
| 137 |
+
gr.Markdown("# Multimodal RAG Chatbot")
|
| 138 |
|
| 139 |
with gr.Row():
|
| 140 |
file_input = gr.File(label="Select files to upload", file_count="multiple")
|
| 141 |
+
load_btn = gr.Button("Load Documents (PDF,CSV,Docx,Pptx,JPG,PNG)
|
| 142 |
|
| 143 |
load_output = gr.Textbox(label="Load Status")
|
| 144 |
|