Update app.py
Browse files
app.py
CHANGED
@@ -39,15 +39,14 @@ def local_query(query, context):
|
|
39 |
|
40 |
inputs = tokenizer(t5query, return_tensors="pt")
|
41 |
|
42 |
-
print('entering model generator')
|
43 |
outputs = model.generate(**inputs, max_new_tokens=20)
|
44 |
-
|
45 |
return tokenizer.batch_decode(outputs, skip_special_tokens=True)
|
46 |
|
47 |
def run_query(file, history, query):
|
48 |
|
49 |
file_name = file.name
|
50 |
-
|
51 |
loader = PDFMinerLoader(file_name)
|
52 |
doc = loader.load()
|
53 |
|
@@ -80,11 +79,15 @@ def run_query(file, history, query):
|
|
80 |
print('printing result after call back')
|
81 |
print(result)
|
82 |
|
|
|
83 |
history = history.append(result)
|
84 |
|
|
|
|
|
|
|
85 |
print('printing history')
|
86 |
print(history)
|
87 |
-
return
|
88 |
|
89 |
|
90 |
|
@@ -107,7 +110,7 @@ with gr.Blocks() as demo:
|
|
107 |
|
108 |
btn = gr.UploadButton("Upload a PDF", file_types=[".pdf"])
|
109 |
output = gr.Textbox(label="Output Box")
|
110 |
-
chatbot = gr.Chatbot(
|
111 |
|
112 |
with gr.Row():
|
113 |
with gr.Column(scale=0.70):
|
|
|
39 |
|
40 |
inputs = tokenizer(t5query, return_tensors="pt")
|
41 |
|
|
|
42 |
outputs = model.generate(**inputs, max_new_tokens=20)
|
43 |
+
|
44 |
return tokenizer.batch_decode(outputs, skip_special_tokens=True)
|
45 |
|
46 |
def run_query(file, history, query):
|
47 |
|
48 |
file_name = file.name
|
49 |
+
|
50 |
loader = PDFMinerLoader(file_name)
|
51 |
doc = loader.load()
|
52 |
|
|
|
79 |
print('printing result after call back')
|
80 |
print(result)
|
81 |
|
82 |
+
|
83 |
history = history.append(result)
|
84 |
|
85 |
+
history.append((query, result))
|
86 |
+
|
87 |
+
|
88 |
print('printing history')
|
89 |
print(history)
|
90 |
+
return chat_history, ""
|
91 |
|
92 |
|
93 |
|
|
|
110 |
|
111 |
btn = gr.UploadButton("Upload a PDF", file_types=[".pdf"])
|
112 |
output = gr.Textbox(label="Output Box")
|
113 |
+
chatbot = gr.Chatbot(height=240)
|
114 |
|
115 |
with gr.Row():
|
116 |
with gr.Column(scale=0.70):
|