Download app.py from mmty/fdl: direct link, hf CLI and curl.
- Browser
- Download file 607 Bytes
-
https://huggingface.co/spaces/mmty/fdl/resolve/main/app.py
- Command line
-
hf download hf://spaces/mmty/fdl/app.py
-
curl -L -o app.py https://huggingface.co/spaces/mmty/fdl/resolve/main/app.py
607 Bytes
| import gradio as gr | |
| import requests | |
| def download_file(url): | |
| response = requests.get(url) | |
| file_name = url.split('/')[-1] | |
| return {"file_name": file_name, "content": response.content} | |
| def serve_file(file_data): | |
| file_name = file_data["file_name"] | |
| content = file_data["content"] | |
| return gr.File.download(content, file_name) | |
| iface = gr.Interface(fn=download_file, | |
| inputs="text", | |
| outputs=serve_file, | |
| title="File Downloader", | |
| description="Enter the URL of the file you want to download.") | |
| iface.launch() | |