rishiraj commited on
Commit
221a8ba
·
verified ·
1 Parent(s): ecddc77

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +53 -0
app.py CHANGED
@@ -159,6 +159,59 @@ with gr.Blocks(title="PDF data extraction with PDF Extractor & Indexify") as pdf
159
  outputs = [model_output_text_box]
160
  )
161
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
  demo = gr.TabbedInterface([marker_demo, pdf_demo, gemini_demo, openai_demo], ["Marker Extractor", "PDF Extractor", "Gemini Extractor", "OpenAI Extractor"], theme=gr.themes.Soft())
163
 
164
  demo.queue()
 
159
  outputs = [model_output_text_box]
160
  )
161
 
162
+ with gr.Blocks(title="PDF data extraction with Gemini & Indexify") as gemini_demo:
163
+ gr.HTML("<h1 style='text-align: center'>PDF data extraction with Gemini & <a href='https://getindexify.ai/'>Indexify</a></h1>")
164
+ 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>")
165
+ 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>")
166
+ 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_gemini.ipynb' target='_blank'>extraction pipleine</a> with Indexify</h4>")
167
+
168
+ with gr.Row():
169
+ with gr.Column():
170
+ gr.HTML(
171
+ "<p><b>Step 1:</b> Upload a PDF file from local storage.</p>"
172
+
173
+ "<p style='color: #A0A0A0;'>Use this demo for single PDF file only. "
174
+ "You can extract from PDF files continuously and try various other extractors locally with "
175
+ "<a href='https://getindexify.ai/'>Indexify</a>.</p>"
176
+ )
177
+
178
+ pdf_file = gr.File(type="filepath")
179
+
180
+ gr.HTML("<p><b>Step 2:</b> Enter your API key.</p>")
181
+
182
+ key = gr.Textbox(
183
+ info="Please enter your GEMINI_API_KEY",
184
+ label="Key:"
185
+ )
186
+
187
+ with gr.Column():
188
+ gr.HTML("<p><b>Step 3:</b> Run the extractor.</p>")
189
+
190
+ go_button = gr.Button(
191
+ value="Run extractor",
192
+ variant="primary",
193
+ )
194
+
195
+ model_output_text_box = gr.Textbox(
196
+ label="Extractor Output",
197
+ elem_id="model_output_text_box",
198
+ )
199
+
200
+ with gr.Row():
201
+
202
+ gr.HTML(
203
+ "<p style='text-align: center'>"
204
+ "Developed with 🫶 by <a href='https://getindexify.ai/' target='_blank'>Indexify</a> | "
205
+ "a <a href='https://www.tensorlake.ai/' target='_blank'>Tensorlake</a> product"
206
+ "</p>"
207
+ )
208
+
209
+ go_button.click(
210
+ fn=use_gemini,
211
+ inputs = [pdf_file, key],
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()