Spaces:
Build error
Build error
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() | |