Download app.py from 13ze/dck: direct link, hf CLI and curl.
- Browser
- Download file 855 Bytes
-
https://huggingface.co/spaces/13ze/dck/resolve/main/app.py
- Command line
-
hf download hf://spaces/13ze/dck/app.py
-
curl -L -o app.py https://huggingface.co/spaces/13ze/dck/resolve/main/app.py
855 Bytes
| import gradio as gr | |
| import subprocess | |
| # Função para baixar e reproduzir um torrent usando WebTorrent CLI | |
| def download_and_play_torrent(magnet_link): | |
| command = f"webtorrent download {magnet_link} --vlc" | |
| process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | |
| stdout, stderr = process.communicate() | |
| if process.returncode == 0: | |
| return "Torrent baixado e reproduzido com sucesso!" | |
| else: | |
| return f"Erro ao baixar ou reproduzir torrent: {stderr.decode('utf-8')}" | |
| # Interface Gradio | |
| iface = gr.Interface( | |
| fn=download_and_play_torrent, | |
| inputs="text", | |
| outputs="text", | |
| title="WebTorrent Gradio Interface", | |
| description="Insira um link magnet para baixar e reproduzir usando WebTorrent.", | |
| ) | |
| # Iniciar a interface Gradio | |
| if __name__ == "__main__": | |
| iface.launch() | |