bgloh commited on
Commit
d516a37
·
verified ·
1 Parent(s): 6a3e9e9

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ # Function to generate a file for download
4
+ def generate_file():
5
+ file_path = "example_file.txt"
6
+
7
+ # Create the file
8
+ with open(file_path, "w") as file:
9
+ file.write("This is a downloadable file.")
10
+
11
+ return file_path
12
+
13
+ # Create a Gradio interface to download the file
14
+ interface = gr.Interface(
15
+ fn=generate_file,
16
+ inputs=None,
17
+ outputs=gr.File(label="Download the file"),
18
+ title="Download File Example"
19
+ )
20
+
21
+ # Launch the Gradio app
22
+ interface.launch()