Update app.py
Browse files
app.py
CHANGED
@@ -5,12 +5,16 @@ from langchain.text_splitter import RecursiveCharacterTextSplitter
|
|
5 |
from langchain.embeddings.huggingface import HuggingFaceEmbeddings
|
6 |
from langchain.document_loaders import PyPDFLoader
|
7 |
from langchain.vectorstores import FAISS
|
|
|
8 |
from glob import glob
|
9 |
from tqdm import tqdm
|
10 |
import gradio as gr
|
11 |
import yaml
|
12 |
|
13 |
|
|
|
|
|
|
|
14 |
def load_config():
|
15 |
with open('config.yaml', 'r') as file:
|
16 |
config = yaml.safe_load(file)
|
@@ -81,12 +85,12 @@ def answer_question(question: str):
|
|
81 |
# Gradio UI for PDFChat
|
82 |
with gr.Blocks() as demo:
|
83 |
with gr.Tab("PdfChat"):
|
84 |
-
with gr.
|
85 |
ans = gr.Textbox(label="Answer", lines=10)
|
86 |
|
87 |
-
que = gr.Textbox(label="Ask a Question", lines=
|
88 |
|
89 |
-
bttn = gr.Button(
|
90 |
|
91 |
bttn.click(fn=answer_question, inputs=[que], outputs=[ans])
|
92 |
|
|
|
5 |
from langchain.embeddings.huggingface import HuggingFaceEmbeddings
|
6 |
from langchain.document_loaders import PyPDFLoader
|
7 |
from langchain.vectorstores import FAISS
|
8 |
+
from dotenv import load_dotenv
|
9 |
from glob import glob
|
10 |
from tqdm import tqdm
|
11 |
import gradio as gr
|
12 |
import yaml
|
13 |
|
14 |
|
15 |
+
load_dotenv()
|
16 |
+
|
17 |
+
|
18 |
def load_config():
|
19 |
with open('config.yaml', 'r') as file:
|
20 |
config = yaml.safe_load(file)
|
|
|
85 |
# Gradio UI for PDFChat
|
86 |
with gr.Blocks() as demo:
|
87 |
with gr.Tab("PdfChat"):
|
88 |
+
with gr.Column():
|
89 |
ans = gr.Textbox(label="Answer", lines=10)
|
90 |
|
91 |
+
que = gr.Textbox(label="Ask a Question", lines=2)
|
92 |
|
93 |
+
bttn = gr.Button(value="Submit")
|
94 |
|
95 |
bttn.click(fn=answer_question, inputs=[que], outputs=[ans])
|
96 |
|