Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +9 -13
src/streamlit_app.py
CHANGED
|
@@ -1,17 +1,8 @@
|
|
| 1 |
-
import altair as alt
|
| 2 |
-
import numpy as np
|
| 3 |
-
import pandas as pd
|
| 4 |
import streamlit as st
|
|
|
|
|
|
|
| 5 |
|
| 6 |
-
""
|
| 7 |
-
# Welcome to Streamlit!
|
| 8 |
-
|
| 9 |
-
Edit `/streamlit_app.py` to customize this app to your heart's desire :heart:.
|
| 10 |
-
If you have any questions, checkout our [documentation](https://docs.streamlit.io) and [community
|
| 11 |
-
forums](https://discuss.streamlit.io).
|
| 12 |
-
|
| 13 |
-
In the meantime, below is an example of what you can do with just a few lines of code:
|
| 14 |
-
"""
|
| 15 |
|
| 16 |
num_points = st.slider("Number of points in spiral", 1, 10000, 1100)
|
| 17 |
num_turns = st.slider("Number of turns in spiral", 1, 300, 31)
|
|
@@ -19,4 +10,9 @@ num_turns = st.slider("Number of turns in spiral", 1, 300, 31)
|
|
| 19 |
uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"])
|
| 20 |
|
| 21 |
if uploaded_file:
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
from PIL import Image
|
| 3 |
+
import io
|
| 4 |
|
| 5 |
+
st.title("Welcome to Streamlit!")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
num_points = st.slider("Number of points in spiral", 1, 10000, 1100)
|
| 8 |
num_turns = st.slider("Number of turns in spiral", 1, 300, 31)
|
|
|
|
| 10 |
uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"])
|
| 11 |
|
| 12 |
if uploaded_file:
|
| 13 |
+
# Convert the uploaded file to an image using PIL
|
| 14 |
+
try:
|
| 15 |
+
image = Image.open(uploaded_file)
|
| 16 |
+
st.image(image, caption="Uploaded Image", use_column_width=True)
|
| 17 |
+
except Exception as e:
|
| 18 |
+
st.error(f"Error displaying image: {e}")
|