Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -21,21 +21,14 @@ def predict(image,max_length=64, num_beams=4):
|
|
21 |
return caption_text
|
22 |
|
23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
-
|
26 |
-
|
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()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|