Update app.py
Browse files
app.py
CHANGED
|
@@ -122,4 +122,14 @@ elif selected == "Chatbot":
|
|
| 122 |
|
| 123 |
elif selected == "Image Captioning":
|
| 124 |
st.title("Image Caption Generation📸")
|
| 125 |
-
upload_image = st.file_uploader("Upload an image...", type=["jpg", "jpeg", "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
|
| 123 |
elif selected == "Image Captioning":
|
| 124 |
st.title("Image Caption Generation📸")
|
| 125 |
+
upload_image = st.file_uploader("Upload an image...", type=["jpg", "jpeg", "png"])
|
| 126 |
+
|
| 127 |
+
if upload_image and st.button("Generate"):
|
| 128 |
+
image = Image.open(upload_image)
|
| 129 |
+
col1, col2 = st.columns(2)
|
| 130 |
+
with col1:
|
| 131 |
+
st.image(image, caption="Uploaded Image", use_column_width=True)
|
| 132 |
+
default_prompt = "Write a caption for this image"
|
| 133 |
+
caption = gemini_pro_vision_responce(default_prompt, image)
|
| 134 |
+
with col2:
|
| 135 |
+
st.info(caption)
|