|
|
import streamlit as st |
|
|
from PIL import Image |
|
|
import time |
|
|
|
|
|
|
|
|
st.title("Streamlit Demo on Hugging Face") |
|
|
|
|
|
|
|
|
st.write("Welcome to a demo app showcasing basic Streamlit components!") |
|
|
|
|
|
|
|
|
uploaded_image = st.file_uploader("Upload an image", type=["jpg", "jpeg", "png"]) |
|
|
uploaded_audio = st.file_uploader("Upload an audio file", type=["mp3", "wav", "ogg"]) |
|
|
|
|
|
|
|
|
if uploaded_image is not None: |
|
|
with st.spinner("Loading image..."): |
|
|
time.sleep(1) |
|
|
image = Image.open(uploaded_image) |
|
|
st.image(image, caption="Uploaded Image", use_column_width=True) |
|
|
|
|
|
|
|
|
if uploaded_audio is not None: |
|
|
with st.spinner("Loading audio..."): |
|
|
time.sleep(1) |
|
|
st.audio(uploaded_audio) |
|
|
|
|
|
|
|
|
if st.button("Click Me"): |
|
|
st.write("๐ You clicked the button!") |