dowload_file / app.py
wasmdashai's picture
Update app.py
7d54bec verified
raw
history blame
578 Bytes
def save_file(file):
# Get the file name
file_name = file.name
# Save the file to the specified folder
file_path = os.path.join(upload_folder, file_name)
with open(file_path, "wb") as f:
f.write(file.read())
return f"File saved to: {file_path}"
# Create the Gradio interface
iface = gr.Interface(
fn=save_file, # The function to handle file saving
inputs=gr.inputs.File(), # Input widget to upload a file
outputs="text" # Output: confirmation message with file path
)
# Launch the app
iface.launch()