Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import fitz # PyMuPDF
|
| 3 |
-
from
|
| 4 |
from langchain_community.vectorstores import FAISS
|
| 5 |
from langchain_huggingface import HuggingFaceEmbeddings
|
| 6 |
import os
|
|
@@ -53,7 +53,6 @@ class VectorSystem:
|
|
| 53 |
return "⚠️ Please enter a Question."
|
| 54 |
|
| 55 |
# We search primarily using the Question to find the 'Ground Truth' in the text.
|
| 56 |
-
# You could also concatenate (Question + " " + Answer) for a broader search.
|
| 57 |
docs = self.vector_store.similarity_search(question, k=3)
|
| 58 |
|
| 59 |
# Format the output
|
|
@@ -78,7 +77,7 @@ with gr.Blocks(title="EduGenius Context Retriever") as demo:
|
|
| 78 |
# Step 1: Upload
|
| 79 |
pdf_input = gr.File(label="1. Upload PDF Chapter", file_types=[".pdf"])
|
| 80 |
upload_btn = gr.Button("Process PDF", variant="primary")
|
| 81 |
-
upload_status = gr.Textbox(label="Status",
|
| 82 |
|
| 83 |
with gr.Column(scale=2):
|
| 84 |
# Step 2: Query
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import fitz # PyMuPDF
|
| 3 |
+
from langchain_text_splitters import RecursiveCharacterTextSplitter
|
| 4 |
from langchain_community.vectorstores import FAISS
|
| 5 |
from langchain_huggingface import HuggingFaceEmbeddings
|
| 6 |
import os
|
|
|
|
| 53 |
return "⚠️ Please enter a Question."
|
| 54 |
|
| 55 |
# We search primarily using the Question to find the 'Ground Truth' in the text.
|
|
|
|
| 56 |
docs = self.vector_store.similarity_search(question, k=3)
|
| 57 |
|
| 58 |
# Format the output
|
|
|
|
| 77 |
# Step 1: Upload
|
| 78 |
pdf_input = gr.File(label="1. Upload PDF Chapter", file_types=[".pdf"])
|
| 79 |
upload_btn = gr.Button("Process PDF", variant="primary")
|
| 80 |
+
upload_status = gr.Textbox(label="Status", interactive=False)
|
| 81 |
|
| 82 |
with gr.Column(scale=2):
|
| 83 |
# Step 2: Query
|