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