ripa1 commited on
Commit
8b4c3aa
·
verified ·
1 Parent(s): dd0b463

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -10
app.py CHANGED
@@ -1,5 +1,4 @@
1
  import gradio as gr
2
-
3
  from transformers import pipeline
4
 
5
  # Image to text function
@@ -8,19 +7,14 @@ def image2text(image_path):
8
  text = captioner(image_path)[0]['generated_text']
9
  return text
10
 
11
-
12
  # Gradio interface
13
  iface = gr.Interface(
14
- fn= image2text,
15
- inputs=[
16
- gr.Image(type="filepath", label="Upload Image"),
17
-
18
- ],
19
  outputs="text",
20
  title="Image Description Generator",
21
  description="Upload an image and get a generated description."
22
  )
23
 
24
-
25
- iface.launch(inline = False)
26
-
 
1
  import gradio as gr
 
2
  from transformers import pipeline
3
 
4
  # Image to text function
 
7
  text = captioner(image_path)[0]['generated_text']
8
  return text
9
 
 
10
  # Gradio interface
11
  iface = gr.Interface(
12
+ fn=image2text,
13
+ inputs=gr.Image(type="filepath", label="Upload Image"),
 
 
 
14
  outputs="text",
15
  title="Image Description Generator",
16
  description="Upload an image and get a generated description."
17
  )
18
 
19
+ if __name__ == "__main__":
20
+ iface.launch(inline=False)