Update: A few changes in UI
Browse files- app.py +12 -6
- src/style.css +1 -1
app.py
CHANGED
@@ -14,11 +14,13 @@ processing = False
|
|
14 |
|
15 |
def load_pdf(pdf_file_path):
|
16 |
global pdf_loaded
|
|
|
|
|
17 |
filename = pdf_file_path.name
|
18 |
global brain
|
19 |
brain = Initializer.initialize(AUG_TOKEN, RES_TOKEN, filename)
|
20 |
pdf_loaded = True
|
21 |
-
return "
|
22 |
|
23 |
|
24 |
def response(query, history):
|
@@ -49,21 +51,25 @@ def loading():
|
|
49 |
with gr.Blocks(css=css) as app:
|
50 |
with gr.Column(elem_id="column_container"):
|
51 |
gr.HTML(title_html)
|
|
|
52 |
with gr.Column():
|
53 |
-
|
|
|
54 |
with gr.Row():
|
55 |
-
status = gr.Label(label="Status", value="
|
56 |
load_pdf_button = gr.Button(value="Process")
|
57 |
|
58 |
-
chatbot = gr.Chatbot([]
|
|
|
|
|
59 |
query = gr.Textbox(
|
60 |
-
label="
|
61 |
placeholder="What do you want to know?",
|
62 |
)
|
63 |
clear = gr.ClearButton([query, chatbot])
|
64 |
gr.HTML(bts_html)
|
65 |
|
66 |
-
load_pdf_button.click(loading, outputs=[status], queue=
|
67 |
load_pdf_button.click(load_pdf, inputs=[pdf], outputs=[status], queue=True)
|
68 |
query.submit(response, [query, chatbot], [query, chatbot], queue=True)
|
69 |
|
|
|
14 |
|
15 |
def load_pdf(pdf_file_path):
|
16 |
global pdf_loaded
|
17 |
+
if pdf_file_path is None:
|
18 |
+
return "Upload PDF First"
|
19 |
filename = pdf_file_path.name
|
20 |
global brain
|
21 |
brain = Initializer.initialize(AUG_TOKEN, RES_TOKEN, filename)
|
22 |
pdf_loaded = True
|
23 |
+
return "Ask Questions Now!"
|
24 |
|
25 |
|
26 |
def response(query, history):
|
|
|
51 |
with gr.Blocks(css=css) as app:
|
52 |
with gr.Column(elem_id="column_container"):
|
53 |
gr.HTML(title_html)
|
54 |
+
|
55 |
with gr.Column():
|
56 |
+
send = gr.Label(value="UPLOAD your PDF below")
|
57 |
+
pdf = gr.File(label="Load your PDF document:", file_types=[".pdf"])
|
58 |
with gr.Row():
|
59 |
+
status = gr.Label(label="Status:", value="Process Document!")
|
60 |
load_pdf_button = gr.Button(value="Process")
|
61 |
|
62 |
+
chatbot = gr.Chatbot([])
|
63 |
+
with gr.Column():
|
64 |
+
send = gr.Label(value="Write your QUESTION bellow and hit ENTER")
|
65 |
query = gr.Textbox(
|
66 |
+
label="Type your questions here:",
|
67 |
placeholder="What do you want to know?",
|
68 |
)
|
69 |
clear = gr.ClearButton([query, chatbot])
|
70 |
gr.HTML(bts_html)
|
71 |
|
72 |
+
load_pdf_button.click(loading, outputs=[status], queue=False)
|
73 |
load_pdf_button.click(load_pdf, inputs=[pdf], outputs=[status], queue=True)
|
74 |
query.submit(response, [query, chatbot], [query, chatbot], queue=True)
|
75 |
|
src/style.css
CHANGED
@@ -51,7 +51,7 @@ li {
|
|
51 |
}
|
52 |
|
53 |
button {
|
54 |
-
background-color: #
|
55 |
color: #000000;
|
56 |
border: none;
|
57 |
border-radius: 8px;
|
|
|
51 |
}
|
52 |
|
53 |
button {
|
54 |
+
background-color: #7af3e517;
|
55 |
color: #000000;
|
56 |
border: none;
|
57 |
border-radius: 8px;
|