Nathanwit commited on
Commit
2a3202e
β€’
1 Parent(s): 994f185

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -17
app.py CHANGED
@@ -21,21 +21,14 @@ def predict(image,max_length=64, num_beams=4):
21
  return caption_text
22
 
23
 
 
 
 
 
 
 
 
 
24
 
25
- input = gr.Image(label="Upload any Image", type = 'pil', optional=True)
26
- output = [gr.Image(label="Processed Image"), gr.Textbox(label="Image Caption")]
27
- examples = [f"example{i}.jpg" for i in range(1,7)]
28
-
29
- title = "Image Captioning "
30
- description = "Made by : shreyasdixit.tech"
31
- interface = gr.Interface(
32
-
33
- fn=predict,
34
- description=description,
35
- inputs = input,
36
- theme="grass",
37
- outputs=output,
38
- examples = examples,
39
- title=title,
40
- )
41
- interface.launch(debug=True)
 
21
  return caption_text
22
 
23
 
24
+ # Gradio Interface
25
+ gradio_app = gr.Interface(
26
+ fn=predict,
27
+ inputs=gr.Image(label="Select image for captioning", sources=['upload', 'webcam'], type="pil"),
28
+ outputs=[gr.Image(label="Processed Image"), gr.Textbox(label="Image Caption")],
29
+ examples = [f"example{i}.jpg" for i in range(1,7)],
30
+ title="Image Captioning with our model",
31
+ )
32
 
33
+ if __name__ == "__main__":
34
+ gradio_app.launch()