Chethu commited on
Commit
4e2c105
1 Parent(s): 017c2bf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -20
app.py CHANGED
@@ -2,31 +2,28 @@ import streamlit as st
2
  from PIL import Image
3
  from predictions import get_predictions
4
 
5
- def main():
6
- st.title("Image Whisper App")
7
 
8
- uploaded_image = st.file_uploader("Upload an image", type=["jpg", "jpeg", "png"])
9
 
10
- if uploaded_image is not None:
11
- st.subheader("Uploaded Image")
12
- st.image(uploaded_image, use_column_width=True)
13
 
14
- if st.button("Submit"):
15
- processed_image, text, audio = get_predictions(uploaded_image)
 
16
 
17
- st.subheader("Output image with predicted instances")
18
- st.image(processed_image, use_column_width=True)
19
 
20
- st.subheader("Textual Description")
21
- st.write(text, "Narration in Text")
22
 
 
 
23
 
24
- st.subheader("Audio Narration")
25
- if isinstance(audio, tuple):
26
- sample_rate, audio_data = audio
27
- st.audio(audio_data, format='audio/wav', sample_rate=sample_rate)
28
- else:
29
- st.audio(audio, format='audio/wav')
30
 
31
- if __name__ == '__main__':
32
- main()
 
 
 
 
 
2
  from PIL import Image
3
  from predictions import get_predictions
4
 
 
 
5
 
6
+ st.title("Image Whisper App")
7
 
8
+ uploaded_image = st.file_uploader("Upload an image", type=["jpg", "jpeg", "png"])
 
 
9
 
10
+ if uploaded_image is not None:
11
+ st.subheader("Uploaded Image")
12
+ st.image(uploaded_image, use_column_width=True)
13
 
14
+ if st.button("Submit"):
15
+ processed_image, text, audio = get_predictions(uploaded_image)
16
 
17
+ st.subheader("Output image with predicted instances")
18
+ st.image(processed_image, use_column_width=True)
19
 
20
+ st.subheader("Textual Description")
21
+ st.write(text, "Narration in Text")
22
 
 
 
 
 
 
 
23
 
24
+ st.subheader("Audio Narration")
25
+ if isinstance(audio, tuple):
26
+ sample_rate, audio_data = audio
27
+ st.audio(audio_data, format='audio/wav', sample_rate=sample_rate)
28
+ else:
29
+ st.audio(audio, format='audio/wav')