test3 / app.py
bgloh's picture
Create app.py
d516a37 verified
raw
history blame contribute delete
506 Bytes
import gradio as gr
# Function to generate a file for download
def generate_file():
file_path = "example_file.txt"
# Create the file
with open(file_path, "w") as file:
file.write("This is a downloadable file.")
return file_path
# Create a Gradio interface to download the file
interface = gr.Interface(
fn=generate_file,
inputs=None,
outputs=gr.File(label="Download the file"),
title="Download File Example"
)
# Launch the Gradio app
interface.launch()