Rsikka21/ComputerVision
0
1import streamlit as st2import os3 4UPLOAD_DIR = "uploaded_files" # Define a directory for uploads5 6st.title("File Uploader to Hugging Face Space")7 8# Create the upload directory if it doesn't exist9#os.makedirs(UPLOAD_DIR, exist_ok=True)10 11uploaded_file = st.file_uploader("Choose a file to upload", type=["txt", "csv", "pdf", "jpg", "png"])12 13if uploaded_file is not None:14 file_path = os.path.join(UPLOAD_DIR, uploaded_file.name)15 with open(file_path, "wb") as f:16 f.write(uploaded_file.getbuffer())17 st.success(f"File '{uploaded_file.name}' uploaded successfully to '{UPLOAD_DIR}'!")18 st.write(f"You can find the file at: {file_path}")19 