Spaces:
Runtime error
Runtime error
Download app.py from Mthrfkr/Spotify_Automated_Track_Recommendation_script: direct link, hf CLI and curl.
- Browser
- Download file 679 Bytes
-
https://huggingface.co/spaces/Mthrfkr/Spotify_Automated_Track_Recommendation_script/resolve/main/app.py
- Command line
-
hf download hf://spaces/Mthrfkr/Spotify_Automated_Track_Recommendation_script/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Mthrfkr/Spotify_Automated_Track_Recommendation_script/resolve/main/app.py
679 Bytes
| import gradio as gr | |
| import io | |
| # Genera un BytesIO con el texto y retorna (BytesIO, nombre) | |
| def return_bytesio(text): | |
| file_bytes = io.BytesIO() | |
| file_bytes.write(text.encode("utf-8")) | |
| file_bytes.seek(0) | |
| return (file_bytes, "output.txt") | |
| with gr.Blocks() as demo: | |
| gr.Markdown("## 📥 Simple Download Demo") | |
| text_input = gr.Textbox(label="Escribe una palabra", placeholder="Ingresa algo...") | |
| file_output = gr.File(label="Descargar Archivo") | |
| download_btn = gr.Button("Generar & Descargar") | |
| download_btn.click( | |
| return_bytesio, | |
| inputs=text_input, | |
| outputs=file_output, | |
| ) | |
| if __name__ == "__main__": | |
| demo.launch() | |