File size: 950 Bytes
63116e6
 
 
 
 
4e2c105
63116e6
4e2c105
63116e6
f8cea28
 
 
 
c39ffc0
 
a5939c2
63116e6
c39ffc0
 
 
 
4cfe5cf
c39ffc0
627d246
63116e6
c39ffc0
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import streamlit as st
from PIL import Image
from predictions import get_predictions


st.title("Image Whisper App")

uploaded_image = st.file_uploader("Upload an image", type=["jpg", "jpeg", "png"])

if uploaded_image is not None:
    st.subheader("Uploaded Image")
    st.image(uploaded_image, use_column_width=True)
    
if st.button("Submit"):
    with st.spinner("Analyzing image and generating narration... Please wait."):
        processed_image, text,audio = get_predictions(uploaded_image)

    st.success("Analysis complete!")
    
    st.subheader("Output image with predicted instances")
    st.image(processed_image, use_column_width=True)

    st.subheader("Textual Description")
    st.write(text)

    st.subheader("Audio Narration")
    if isinstance(audio, tuple):
        sample_rate, audio_data = audio
        st.audio(audio_data, format='audio/wav', sample_rate=sample_rate)
    else:
        st.audio(audio, format='audio/wav')