Update app.py
Browse files
app.py
CHANGED
@@ -36,26 +36,21 @@ def pdf_to_text(pdf_file, query):
|
|
36 |
qa = VectorDBQA.from_chain_type(llm=OpenAI(), chain_type="stuff", vectorstore=vectorstore)
|
37 |
return qa.run(query)
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
# Define the Gradio interface
|
44 |
-
pdf_input = gr.inputs.File(label="PDF File")
|
45 |
query_input = gr.inputs.Textbox(label="Query")
|
46 |
outputs = gr.outputs.Textbox(label="Chatbot Response")
|
47 |
-
interface = gr.Interface(fn=pdf_to_text, inputs=[pdf_input, query_input], outputs=outputs
|
48 |
-
'samples/walmart-10k.pdf'],
|
49 |
-
['What efforts are being made in regards to digital experiences?',
|
50 |
-
'samples/walmart-10k.pdf'],
|
51 |
-
["How much does the company grow?",
|
52 |
-
'samples/walmart-10k.pdf'],
|
53 |
-
['What are the strategic initiatives?',
|
54 |
-
'samples/pfizer-10k.pdf'],
|
55 |
-
['What efforts are being made in regards to digital experiences?',
|
56 |
-
'samples/pfizer-10k.pdf'],
|
57 |
-
["How much does the company grow?",
|
58 |
-
'samples/pfizer-10k.pdf'], ])
|
59 |
|
60 |
# Run the interface
|
61 |
interface.launch(debug = True)
|
|
|
36 |
qa = VectorDBQA.from_chain_type(llm=OpenAI(), chain_type="stuff", vectorstore=vectorstore)
|
37 |
return qa.run(query)
|
38 |
|
39 |
+
examples = [
|
40 |
+
[os.path.abspath("NASDAQ_AAPL_2020.pdf"), "how much are the outstanding shares ?"],
|
41 |
+
[os.path.abspath("NASDAQ_AAPL_2020.pdf"), "what is competitors strategy ?"],
|
42 |
+
[os.path.abspath("NASDAQ_AAPL_2020.pdf"), "who is the chief executive officer ?"],
|
43 |
+
[os.path.abspath("NASDAQ_MSFT_2020.pdf"), "How much is the guided revenue for next quarter?"],
|
44 |
+
]
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
# Define the Gradio interface
|
50 |
+
pdf_input = [gr.inputs.File(label="PDF File"),gr.inputs.Textbox(label="Question:"), gr.inputs.Dropdown(choices=["minilm-uncased-squad2","roberta-base-squad2"],label="Model")]
|
51 |
query_input = gr.inputs.Textbox(label="Query")
|
52 |
outputs = gr.outputs.Textbox(label="Chatbot Response")
|
53 |
+
interface = gr.Interface(fn=pdf_to_text, inputs=[pdf_input, query_input], outputs=outputs)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
|
55 |
# Run the interface
|
56 |
interface.launch(debug = True)
|