test0424 / app.py
ccclllwww's picture
Update app.py
0b52abf verified
raw
history blame contribute delete
952 Bytes
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!")