13ze commited on
Commit
d4b8e75
1 Parent(s): d4e9b4d

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import os
3
+ from uuid import uuid4
4
+
5
+ def upload_file(file):
6
+ file_path = f"/tmp/{uuid4()}-{file.name}"
7
+ with open(file_path, "wb") as f:
8
+ f.write(file.read())
9
+ download_url = f"https://huggingface.co/space-name/download?file={file_path}"
10
+ return download_url
11
+
12
+ iface = gr.Interface(
13
+ fn=upload_file,
14
+ inputs="file",
15
+ outputs="text",
16
+ title="File Upload and Download URL Generator",
17
+ description="Upload a file and get a downloadable URL."
18
+ )
19
+
20
+ iface.launch()