Spaces:
Running
on
Zero
Running
on
Zero
try no highlights
Browse files
app.py
CHANGED
@@ -60,7 +60,7 @@ prompt_suffix = "<|end|>\n"
|
|
60 |
|
61 |
@spaces.GPU
|
62 |
def run_example(image, model_id= "nanonets/Nanonets-OCR-s", prompt= """Extract the text from the above document as if you were reading it naturally. Return the tables in html format. Return the equations in LaTeX representation. If there is an image in the document and image caption is not present, add a small description of the image inside the <img></img> tag; otherwise, add the image caption inside <img></img>. Watermarks should be wrapped in brackets. Ex: <watermark>OFFICIAL COPY</watermark>. Page numbers should be wrapped in brackets. Ex: <page_number>14</page_number> or <page_number>9/22</page_number>. Prefer using ☐ and ☑ for check boxes."""):
|
63 |
-
|
64 |
image_path = array_to_image_path(image)
|
65 |
|
66 |
model = models[model_id]
|
@@ -105,8 +105,7 @@ def run_example(image, model_id= "nanonets/Nanonets-OCR-s", prompt= """Extract t
|
|
105 |
|
106 |
ocr_text = output_text[0]
|
107 |
|
108 |
-
return ocr_text, ocr_text
|
109 |
-
|
110 |
|
111 |
|
112 |
with gr.Blocks() as demo:
|
@@ -122,7 +121,7 @@ with gr.Blocks() as demo:
|
|
122 |
|
123 |
submit_btn = gr.Button(value="Submit", elem_classes="submit-btn")
|
124 |
with gr.Column(elem_classes="output-container"):
|
125 |
-
output_text = gr.
|
126 |
|
127 |
|
128 |
|
|
|
60 |
|
61 |
@spaces.GPU
|
62 |
def run_example(image, model_id= "nanonets/Nanonets-OCR-s", prompt= """Extract the text from the above document as if you were reading it naturally. Return the tables in html format. Return the equations in LaTeX representation. If there is an image in the document and image caption is not present, add a small description of the image inside the <img></img> tag; otherwise, add the image caption inside <img></img>. Watermarks should be wrapped in brackets. Ex: <watermark>OFFICIAL COPY</watermark>. Page numbers should be wrapped in brackets. Ex: <page_number>14</page_number> or <page_number>9/22</page_number>. Prefer using ☐ and ☑ for check boxes."""):
|
63 |
+
print(f'hi, I\'m {model_id}')
|
64 |
image_path = array_to_image_path(image)
|
65 |
|
66 |
model = models[model_id]
|
|
|
105 |
|
106 |
ocr_text = output_text[0]
|
107 |
|
108 |
+
return ocr_text, ocr_text
|
|
|
109 |
|
110 |
|
111 |
with gr.Blocks() as demo:
|
|
|
121 |
|
122 |
submit_btn = gr.Button(value="Submit", elem_classes="submit-btn")
|
123 |
with gr.Column(elem_classes="output-container"):
|
124 |
+
output_text = gr.Textbox(label="Output Text", elem_id="output")
|
125 |
|
126 |
|
127 |
|