Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -212,6 +212,59 @@ with gr.Blocks(title="PDF data extraction with Gemini & Indexify") as gemini_dem
|
|
| 212 |
outputs = [model_output_text_box]
|
| 213 |
)
|
| 214 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 215 |
demo = gr.TabbedInterface([marker_demo, pdf_demo, gemini_demo, openai_demo], ["Marker Extractor", "PDF Extractor", "Gemini Extractor", "OpenAI Extractor"], theme=gr.themes.Soft())
|
| 216 |
|
| 217 |
demo.queue()
|
|
|
|
| 212 |
outputs = [model_output_text_box]
|
| 213 |
)
|
| 214 |
|
| 215 |
+
with gr.Blocks(title="PDF data extraction with OpenAI & Indexify") as openai_demo:
|
| 216 |
+
gr.HTML("<h1 style='text-align: center'>PDF data extraction with OpenAI & <a href='https://getindexify.ai/'>Indexify</a></h1>")
|
| 217 |
+
gr.HTML("<p style='text-align: center'>Indexify is a scalable realtime and continuous indexing and structured extraction engine for unstructured data to build generative AI applications</p>")
|
| 218 |
+
gr.HTML("<h3 style='text-align: center'>If you like this demo, please ⭐ Star us on <a href='https://github.com/tensorlakeai/indexify' target='_blank'>GitHub</a>!</h3>")
|
| 219 |
+
gr.HTML("<h4 style='text-align: center'>Here's an example notebook that demonstrates how to build a continous <a href='https://github.com/tensorlakeai/indexify/blob/main/docs/docs/examples/multimodal_openai.ipynb' target='_blank'>extraction pipleine</a> with Indexify</h4>")
|
| 220 |
+
|
| 221 |
+
with gr.Row():
|
| 222 |
+
with gr.Column():
|
| 223 |
+
gr.HTML(
|
| 224 |
+
"<p><b>Step 1:</b> Upload a PDF file from local storage.</p>"
|
| 225 |
+
|
| 226 |
+
"<p style='color: #A0A0A0;'>Use this demo for single PDF file only. "
|
| 227 |
+
"You can extract from PDF files continuously and try various other extractors locally with "
|
| 228 |
+
"<a href='https://getindexify.ai/'>Indexify</a>.</p>"
|
| 229 |
+
)
|
| 230 |
+
|
| 231 |
+
pdf_file = gr.File(type="filepath")
|
| 232 |
+
|
| 233 |
+
gr.HTML("<p><b>Step 2:</b> Enter your API key.</p>")
|
| 234 |
+
|
| 235 |
+
key = gr.Textbox(
|
| 236 |
+
info="Please enter your OPENAI_API_KEY",
|
| 237 |
+
label="Key:"
|
| 238 |
+
)
|
| 239 |
+
|
| 240 |
+
with gr.Column():
|
| 241 |
+
gr.HTML("<p><b>Step 3:</b> Run the extractor.</p>")
|
| 242 |
+
|
| 243 |
+
go_button = gr.Button(
|
| 244 |
+
value="Run extractor",
|
| 245 |
+
variant="primary",
|
| 246 |
+
)
|
| 247 |
+
|
| 248 |
+
model_output_text_box = gr.Textbox(
|
| 249 |
+
label="Extractor Output",
|
| 250 |
+
elem_id="model_output_text_box",
|
| 251 |
+
)
|
| 252 |
+
|
| 253 |
+
with gr.Row():
|
| 254 |
+
|
| 255 |
+
gr.HTML(
|
| 256 |
+
"<p style='text-align: center'>"
|
| 257 |
+
"Developed with 🫶 by <a href='https://getindexify.ai/' target='_blank'>Indexify</a> | "
|
| 258 |
+
"a <a href='https://www.tensorlake.ai/' target='_blank'>Tensorlake</a> product"
|
| 259 |
+
"</p>"
|
| 260 |
+
)
|
| 261 |
+
|
| 262 |
+
go_button.click(
|
| 263 |
+
fn=use_openai,
|
| 264 |
+
inputs = [pdf_file, key],
|
| 265 |
+
outputs = [model_output_text_box]
|
| 266 |
+
)
|
| 267 |
+
|
| 268 |
demo = gr.TabbedInterface([marker_demo, pdf_demo, gemini_demo, openai_demo], ["Marker Extractor", "PDF Extractor", "Gemini Extractor", "OpenAI Extractor"], theme=gr.themes.Soft())
|
| 269 |
|
| 270 |
demo.queue()
|