sotirios-slv commited on
Commit
3b925dc
1 Parent(s): 9ebbd2b

Moved around image naming thing

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -30,7 +30,6 @@ def get_named_entities(ocr_text: str):
30
 
31
  entities = "\n".join(entities)
32
 
33
- print("ENTITIES ", entities)
34
  return entities
35
 
36
 
@@ -41,7 +40,7 @@ def run(image, lang="eng"):
41
  return result, ner
42
 
43
 
44
- def download_output(image_name: str, ocr_text: str, named_entities: str):
45
  try:
46
  columns = ["OCR text", "Named entities"]
47
  named_entities_list = named_entities.split("\n")
@@ -65,7 +64,7 @@ with gr.Blocks() as demo:
65
  image_in = gr.Image(type="pil")
66
  lang = gr.Dropdown(choices, value="eng")
67
  btn = gr.Button("Run")
68
- image_name = "Test"
69
  print("image_in", image_in)
70
  with gr.Column():
71
  ocr_text = gr.TextArea(label="OCR output")
@@ -79,7 +78,7 @@ with gr.Blocks() as demo:
79
  btn.click(fn=run, inputs=[image_in, lang], outputs=[ocr_text, ner])
80
  download_btn.click(
81
  fn=download_output,
82
- inputs=[image_name, ocr_text, ner],
83
  outputs=[gr.components.File()],
84
  )
85
 
 
30
 
31
  entities = "\n".join(entities)
32
 
 
33
  return entities
34
 
35
 
 
40
  return result, ner
41
 
42
 
43
+ def download_output(ocr_text: str, named_entities: str, image_name="test"):
44
  try:
45
  columns = ["OCR text", "Named entities"]
46
  named_entities_list = named_entities.split("\n")
 
64
  image_in = gr.Image(type="pil")
65
  lang = gr.Dropdown(choices, value="eng")
66
  btn = gr.Button("Run")
67
+ # image_name = "Test"
68
  print("image_in", image_in)
69
  with gr.Column():
70
  ocr_text = gr.TextArea(label="OCR output")
 
78
  btn.click(fn=run, inputs=[image_in, lang], outputs=[ocr_text, ner])
79
  download_btn.click(
80
  fn=download_output,
81
+ inputs=[ocr_text, ner],
82
  outputs=[gr.components.File()],
83
  )
84