Spaces:
Build error
Build error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from PIL import Image
|
| 3 |
+
import io
|
| 4 |
+
|
| 5 |
+
st.title("Artisan Product Submission Form")
|
| 6 |
+
|
| 7 |
+
uploaded_file = st.file_uploader("Choose a file", type=["png", "jpg", "jpeg"])
|
| 8 |
+
|
| 9 |
+
if uploaded_file is not None:
|
| 10 |
+
# To read file as bytes:
|
| 11 |
+
bytes_data = uploaded_file.getvalue()
|
| 12 |
+
st.write("Filename: ", uploaded_file.name)
|
| 13 |
+
# st.write(bytes_data) # This will display the raw bytes, typically not useful for users
|
| 14 |
+
|
| 15 |
+
# To display the image
|
| 16 |
+
image = Image.open(io.BytesIO(bytes_data))
|
| 17 |
+
st.image(image, caption='Uploaded Image.', use_column_width=True)
|
| 18 |
+
|
| 19 |
+
# Creating text input box
|
| 20 |
+
|
| 21 |
+
st.header("Tell us about your product")
|
| 22 |
+
|
| 23 |
+
# Input fields
|
| 24 |
+
product_type = st.text_input("Type of Product", placeholder="e.g., Handmade Jewelry, Pottery, Painting")
|
| 25 |
+
product_origin = st.text_input("Product Origin", placeholder="e.g., City, Country, Region")
|
| 26 |
+
product_description = st.text_area("Brief Description", placeholder="Provide a brief description of your product")
|
| 27 |
+
|
| 28 |
+
# Submit button
|
| 29 |
+
if st.button("Submit"):
|
| 30 |
+
st.write("Thank you for your submission!")
|
| 31 |
+
st.write("### Product Details")
|
| 32 |
+
st.write(f"**Type of Product:** {product_type}")
|
| 33 |
+
st.write(f"**Product Origin:** {product_origin}")
|
| 34 |
+
st.write(f"**Description:** {product_description}")
|