File size: 714 Bytes
eefaa37
 
 
4cf9976
 
eefaa37
4cf9976
 
 
 
 
eefaa37
4cf9976
 
eefaa37
4cf9976
 
 
 
 
eefaa37
4cf9976
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import streamlit as st
import os

# Define a writable directory inside the app environment
UPLOAD_DIR = './uploads'  # Adjust to a directory where you have write permissions

# Create the directory if it doesn't exist
if not os.path.exists(UPLOAD_DIR):
    os.makedirs(UPLOAD_DIR)

st.title('Upload and Process Files')

# File uploader
uploaded_file = st.file_uploader("Choose a file")

if uploaded_file is not None:
    # Save the uploaded file
    with open(os.path.join(UPLOAD_DIR, uploaded_file.name), 'wb') as f:
        f.write(uploaded_file.getbuffer())
    st.success('File uploaded successfully!')

    # Optionally, you can add more code to process the file
    # e.g., use ffmpeg, display the file, etc.