apjanco commited on
Commit
e611474
·
1 Parent(s): 81db712

try no highlights

Browse files
Files changed (1) hide show
  1. app.py +3 -4
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 # Return twice: once for display, once for state
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.HighlightedText(label="Output Text", elem_id="output")
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