Update app.py
Browse files
app.py
CHANGED
|
@@ -2,26 +2,29 @@ import streamlit as st
|
|
| 2 |
from PIL import Image
|
| 3 |
import time
|
| 4 |
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
image = Image.open(
|
| 20 |
-
st.image(image, caption="
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
from PIL import Image
|
| 3 |
import time
|
| 4 |
|
| 5 |
+
# App title
|
| 6 |
+
st.title("Streamlit Demo on Hugging Face")
|
| 7 |
+
|
| 8 |
+
# Write some text
|
| 9 |
+
st.write("Welcome to a demo app showcasing basic Streamlit components!")
|
| 10 |
+
|
| 11 |
+
# File uploader for image and audio
|
| 12 |
+
uploaded_image = st.file_uploader("Upload an image", type=["jpg", "jpeg", "png"])
|
| 13 |
+
uploaded_audio = st.file_uploader("Upload an audio file", type=["mp3", "wav", "ogg"])
|
| 14 |
+
|
| 15 |
+
# Display image with spinner
|
| 16 |
+
if uploaded_image is not None:
|
| 17 |
+
with st.spinner("Loading image..."):
|
| 18 |
+
time.sleep(1) # Simulate a delay
|
| 19 |
+
image = Image.open(uploaded_image)
|
| 20 |
+
st.image(image, caption="Uploaded Image", use_column_width=True)
|
| 21 |
+
|
| 22 |
+
# Play audio with spinner
|
| 23 |
+
if uploaded_audio is not None:
|
| 24 |
+
with st.spinner("Loading audio..."):
|
| 25 |
+
time.sleep(1) # Simulate a delay
|
| 26 |
+
st.audio(uploaded_audio)
|
| 27 |
+
|
| 28 |
+
# Button interaction
|
| 29 |
+
if st.button("Click Me"):
|
| 30 |
+
st.write("🎉 You clicked the button!")
|