sooooner commited on
Commit
4ed8c02
Β·
1 Parent(s): c0e69ff

multiple inputs

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -9,7 +9,7 @@ from utils import Image2Text
9
  @spaces.GPU(duration=15)
10
  def greet(input_img):
11
  global image_to_text
12
- contents = image_to_text.get_text(input_img, num_beams=4)
13
  return '\n'.join(contents)
14
 
15
  examples_path = os.path.dirname(__file__)
@@ -23,10 +23,15 @@ if __name__ == "__main__":
23
 
24
  demo = gr.Interface(
25
  fn=greet,
26
- inputs="image",
 
 
 
 
 
27
  outputs="text",
28
  title=f"🍩 for Hwp math problems",
29
- examples=[os.path.join(examples_path, "samples", img_name) for img_name in sorted(os.listdir("samples"))],
30
  cache_examples=True
31
  )
32
 
 
9
  @spaces.GPU(duration=15)
10
  def greet(input_img):
11
  global image_to_text
12
+ contents = image_to_text.get_text(input_img[0], num_beams=4)
13
  return '\n'.join(contents)
14
 
15
  examples_path = os.path.dirname(__file__)
 
23
 
24
  demo = gr.Interface(
25
  fn=greet,
26
+ # inputs="image",
27
+ inputs=gr.File(
28
+ label="Drag (Select) 1 or more photos of your face",
29
+ file_types=["image"],
30
+ file_count="multiple"
31
+ ),
32
  outputs="text",
33
  title=f"🍩 for Hwp math problems",
34
+ # examples=[os.path.join(examples_path, "samples", img_name) for img_name in sorted(os.listdir("samples"))],
35
  cache_examples=True
36
  )
37