Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -123,6 +123,7 @@ There are three models available:
|
|
123 |
"""
|
124 |
|
125 |
example_images = list(Path(__file__).parent.glob("*.jpeg"))
|
|
|
126 |
|
127 |
with gr.Blocks(title="Arabic Nougat") as demo:
|
128 |
gr.HTML(
|
@@ -155,14 +156,21 @@ with gr.Blocks(title="Arabic Nougat") as demo:
|
|
155 |
with gr.Tab("Extract Text from PDF"):
|
156 |
with gr.Row():
|
157 |
with gr.Column():
|
158 |
-
|
159 |
model_dropdown = gr.Dropdown(
|
160 |
label="Model", choices=list(models_supported.keys()), value=None
|
161 |
)
|
162 |
pdf_submit_button = gr.Button(value="Submit", variant="primary")
|
163 |
output = gr.Markdown(label="Output Markdown", rtl=True)
|
164 |
pdf_submit_button.click(
|
165 |
-
extract_text_from_pdf, inputs=[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
166 |
)
|
167 |
|
168 |
demo.queue().launch(share=False)
|
|
|
123 |
"""
|
124 |
|
125 |
example_images = list(Path(__file__).parent.glob("*.jpeg"))
|
126 |
+
example_pdfs = list(Path(__file__).parent.glob("*.pdf"))
|
127 |
|
128 |
with gr.Blocks(title="Arabic Nougat") as demo:
|
129 |
gr.HTML(
|
|
|
156 |
with gr.Tab("Extract Text from PDF"):
|
157 |
with gr.Row():
|
158 |
with gr.Column():
|
159 |
+
input_pdf = PDF(label="Input PDF")
|
160 |
model_dropdown = gr.Dropdown(
|
161 |
label="Model", choices=list(models_supported.keys()), value=None
|
162 |
)
|
163 |
pdf_submit_button = gr.Button(value="Submit", variant="primary")
|
164 |
output = gr.Markdown(label="Output Markdown", rtl=True)
|
165 |
pdf_submit_button.click(
|
166 |
+
extract_text_from_pdf, inputs=[input_pdf, model_dropdown], outputs=output
|
167 |
+
)
|
168 |
+
gr.Examples(
|
169 |
+
example_pdfs,
|
170 |
+
[input_pdf],
|
171 |
+
output,
|
172 |
+
extract_text_from_pdf,
|
173 |
+
cache_examples=False,
|
174 |
)
|
175 |
|
176 |
demo.queue().launch(share=False)
|