FFmpeg / app.py
RandomPersonRR's picture
Update app.py
4cf9976 verified
raw
history blame
714 Bytes
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.