Spaces:
Runtime error
Runtime error
File size: 578 Bytes
7d54bec 6804d36 7d54bec 6804d36 7d54bec |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
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() |