Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -31,18 +31,18 @@ with gr.Blocks(title="PDF data extraction with Gemini & Indexify") as gemini_dem
|
|
31 |
"You can extract from PDF files continuously and try various other extractors locally with "
|
32 |
"<a href='https://getindexify.ai/'>Indexify</a>.</p>"
|
33 |
)
|
34 |
-
|
35 |
gr.HTML("<p><b>Step 2:</b> Enter your API key.</p>")
|
36 |
-
|
37 |
with gr.Column():
|
38 |
gr.HTML("<p><b>Step 3:</b> Run the extractor.</p>")
|
39 |
-
|
40 |
-
|
41 |
|
42 |
with gr.Row():
|
43 |
gr.HTML("<p style='text-align: center'>Developed with 🫶 by <a href='https://getindexify.ai/' target='_blank'>Indexify</a> | a <a href='https://www.tensorlake.ai/' target='_blank'>Tensorlake</a> product</p>")
|
44 |
|
45 |
-
|
46 |
|
47 |
def use_openai(pdf_filepath, key):
|
48 |
if pdf_filepath is None:
|
@@ -68,18 +68,18 @@ with gr.Blocks(title="PDF data extraction with OpenAI & Indexify") as openai_dem
|
|
68 |
"You can extract from PDF files continuously and try various other extractors locally with "
|
69 |
"<a href='https://getindexify.ai/'>Indexify</a>.</p>"
|
70 |
)
|
71 |
-
|
72 |
gr.HTML("<p><b>Step 2:</b> Enter your API key.</p>")
|
73 |
-
|
74 |
with gr.Column():
|
75 |
gr.HTML("<p><b>Step 3:</b> Run the extractor.</p>")
|
76 |
-
|
77 |
-
|
78 |
|
79 |
with gr.Row():
|
80 |
gr.HTML("<p style='text-align: center'>Developed with 🫶 by <a href='https://getindexify.ai/' target='_blank'>Indexify</a> | a <a href='https://www.tensorlake.ai/' target='_blank'>Tensorlake</a> product</p>")
|
81 |
|
82 |
-
|
83 |
|
84 |
demo = gr.TabbedInterface([gemini_demo, openai_demo], ["Gemini Extractor", "OpenAI Extractor"], theme=gr.themes.Soft())
|
85 |
|
|
|
31 |
"You can extract from PDF files continuously and try various other extractors locally with "
|
32 |
"<a href='https://getindexify.ai/'>Indexify</a>.</p>"
|
33 |
)
|
34 |
+
pdf_file_1 = gr.File(type="filepath")
|
35 |
gr.HTML("<p><b>Step 2:</b> Enter your API key.</p>")
|
36 |
+
key_1 = gr.Textbox(info="Please enter your GEMINI_API_KEY", label="Key:")
|
37 |
with gr.Column():
|
38 |
gr.HTML("<p><b>Step 3:</b> Run the extractor.</p>")
|
39 |
+
go_button_1 = gr.Button(value="Run Gemini extractor", variant="primary")
|
40 |
+
model_output_text_box_1 = gr.Textbox(label="Extractor Output", elem_id="model_output_text_box_1")
|
41 |
|
42 |
with gr.Row():
|
43 |
gr.HTML("<p style='text-align: center'>Developed with 🫶 by <a href='https://getindexify.ai/' target='_blank'>Indexify</a> | a <a href='https://www.tensorlake.ai/' target='_blank'>Tensorlake</a> product</p>")
|
44 |
|
45 |
+
go_button_1.click(fn=use_gemini, inputs=[pdf_file_1, key_1], outputs=[model_output_text_box_1])
|
46 |
|
47 |
def use_openai(pdf_filepath, key):
|
48 |
if pdf_filepath is None:
|
|
|
68 |
"You can extract from PDF files continuously and try various other extractors locally with "
|
69 |
"<a href='https://getindexify.ai/'>Indexify</a>.</p>"
|
70 |
)
|
71 |
+
pdf_file_2 = gr.File(type="filepath")
|
72 |
gr.HTML("<p><b>Step 2:</b> Enter your API key.</p>")
|
73 |
+
key_2 = gr.Textbox(info="Please enter your OPENAI_API_KEY", label="Key:")
|
74 |
with gr.Column():
|
75 |
gr.HTML("<p><b>Step 3:</b> Run the extractor.</p>")
|
76 |
+
go_button_2 = gr.Button(value="Run OpenAI extractor", variant="primary")
|
77 |
+
model_output_text_box_2 = gr.Textbox(label="Extractor Output", elem_id="model_output_text_box_2")
|
78 |
|
79 |
with gr.Row():
|
80 |
gr.HTML("<p style='text-align: center'>Developed with 🫶 by <a href='https://getindexify.ai/' target='_blank'>Indexify</a> | a <a href='https://www.tensorlake.ai/' target='_blank'>Tensorlake</a> product</p>")
|
81 |
|
82 |
+
go_button_2.click(fn=use_openai, inputs=[pdf_file_2, key_2], outputs=[model_output_text_box_2])
|
83 |
|
84 |
demo = gr.TabbedInterface([gemini_demo, openai_demo], ["Gemini Extractor", "OpenAI Extractor"], theme=gr.themes.Soft())
|
85 |
|