fdl / app.py
mmty's picture
Update app.py
6551b47 verified
Raw History Blame Contribute Delete
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()