Szeyu commited on
Commit
8876549
·
verified ·
1 Parent(s): 91aac52

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -0
app.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
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!")