Spaces:
Runtime error
Runtime error
import gradio as gr | |
import os | |
from uuid import uuid4 | |
def upload_file(file): | |
file_path = f"/tmp/{uuid4()}-{file.name}" | |
with open(file_path, "wb") as f: | |
f.write(file.read()) | |
download_url = f"https://huggingface.co/space-name/download?file={file_path}" | |
return download_url | |
iface = gr.Interface( | |
fn=upload_file, | |
inputs="file", | |
outputs="text", | |
title="File Upload and Download URL Generator", | |
description="Upload a file and get a downloadable URL." | |
) | |
iface.launch() | |