Update app.py
Browse files
app.py
CHANGED
|
@@ -1,29 +1,34 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
-
import time
|
| 3 |
from PIL import Image
|
|
|
|
| 4 |
|
| 5 |
# Title of the app
|
| 6 |
st.title("Streamlit Demo App")
|
| 7 |
|
| 8 |
-
#
|
| 9 |
-
st.write("Welcome to
|
| 10 |
|
| 11 |
-
# File uploader
|
| 12 |
-
uploaded_file = st.file_uploader("Choose
|
| 13 |
-
if uploaded_file is not None:
|
| 14 |
-
st.write("File uploaded:", uploaded_file.name)
|
| 15 |
|
| 16 |
-
|
| 17 |
-
|
| 18 |
image = Image.open(uploaded_file)
|
| 19 |
-
st.image(image, caption='Uploaded Image', use_column_width=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
-
|
| 22 |
-
if st.button('Start Loading'):
|
| 23 |
-
with st.spinner("Loading..."):
|
| 24 |
-
time.sleep(2) # Simulating a long computation
|
| 25 |
-
st.success("Loading complete!")
|
| 26 |
|
| 27 |
-
#
|
| 28 |
-
if
|
| 29 |
-
st.
|
|
|
|
| 1 |
import streamlit as st
|
|
|
|
| 2 |
from PIL import Image
|
| 3 |
+
import time
|
| 4 |
|
| 5 |
# Title of the app
|
| 6 |
st.title("Streamlit Demo App")
|
| 7 |
|
| 8 |
+
# Writing some text
|
| 9 |
+
st.write("Welcome to the Streamlit demo app! Here you can upload files, view images, and play audio.")
|
| 10 |
|
| 11 |
+
# File uploader for images
|
| 12 |
+
uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"])
|
|
|
|
|
|
|
| 13 |
|
| 14 |
+
if uploaded_file is not None:
|
| 15 |
+
# Display the uploaded image
|
| 16 |
image = Image.open(uploaded_file)
|
| 17 |
+
st.image(image, caption='Uploaded Image.', use_column_width=True)
|
| 18 |
+
|
| 19 |
+
# Audio file uploader
|
| 20 |
+
audio_file = st.file_uploader("Choose an audio file...", type=["mp3", "wav"])
|
| 21 |
+
|
| 22 |
+
if audio_file is not None:
|
| 23 |
+
# Play the uploaded audio file
|
| 24 |
+
st.audio(audio_file)
|
| 25 |
+
|
| 26 |
+
# Using a spinner during a time-consuming task
|
| 27 |
+
with st.spinner('Loading...'):
|
| 28 |
+
time.sleep(2) # Simulating a long computation
|
| 29 |
|
| 30 |
+
st.success('Done!')
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
+
# Button to trigger an action
|
| 33 |
+
if st.button('Click me'):
|
| 34 |
+
st.write("You clicked the button!")
|