File size: 952 Bytes
2397706
 
0b52abf
2397706
 
 
 
0b52abf
 
2397706
0b52abf
 
2397706
0b52abf
 
2397706
0b52abf
 
 
 
 
 
 
 
 
 
 
 
2397706
0b52abf
2397706
0b52abf
 
 
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
32
33
34
import streamlit as st
from PIL import Image
import time

# Title of the app
st.title("Streamlit Demo App")

# Writing some text
st.write("Welcome to the Streamlit demo app! Here you can upload files, view images, and play audio.")

# File uploader for images
uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"])

if uploaded_file is not None:
    # Display the uploaded image
    image = Image.open(uploaded_file)
    st.image(image, caption='Uploaded Image.', use_column_width=True)

# Audio file uploader
audio_file = st.file_uploader("Choose an audio file...", type=["mp3", "wav"])

if audio_file is not None:
    # Play the uploaded audio file
    st.audio(audio_file)

# Using a spinner during a time-consuming task
with st.spinner('Loading...'):
    time.sleep(2)  # Simulating a long computation

st.success('Done!')

# Button to trigger an action
if st.button('Click me'):
    st.write("You clicked the button!")