import streamlit as st import requests from PIL import Image st.title("Image Captioning with Fine-Tuned BLiPv2 Model") uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"]) if uploaded_file is not None: image = Image.open(uploaded_file) st.image(image, caption="Uploaded Image", use_column_width=True) files = {"file": uploaded_file.getvalue()} print("Sending API request") response = requests.post("http://0.0.0.0:8502/generate-caption/", files=files) caption = response.json().get("caption") st.write("Generated Caption:") st.write(f"**{caption}**")