Spaces:
Build error
Build error
File size: 951 Bytes
0331cab |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
import streamlit as st
import pandas as pd
from PIL import Image
# Define the function signature
def display_data(data: pd.DataFrame):
st.experimental_data_editor(data)
# Create the Streamlit app
def main():
st.title("Upload Files and Display Data in Function Signature")
# Create an upload form for CSV files
st.subheader("Upload CSV Files")
csv_file = st.file_uploader("Choose a CSV file", type=["csv"])
# Create an upload form for image files
st.subheader("Upload Image Files")
image_file = st.file_uploader("Choose an image file", type=["jpg", "jpeg", "png"])
# Check if files are uploaded and display data in function signature
if csv_file is not None:
data = pd.read_csv(csv_file)
display_data(data)
if image_file is not None:
image = Image.open(image_file)
st.image(image, caption="Uploaded Image")
if __name__ == "__main__":
main()
|