Spaces:
Sleeping
Sleeping
Download generated/main.py from JonCard/infiniteradio: direct link, hf CLI and curl.
- Browser
- Download file 1.4 kB
-
https://huggingface.co/spaces/JonCard/infiniteradio/resolve/main/generated/main.py
- Command line
-
hf download hf://spaces/JonCard/infiniteradio/generated/main.py
-
curl -L -o main.py https://huggingface.co/spaces/JonCard/infiniteradio/resolve/main/generated/main.py
1.4 kB
| # generated by fastapi-codegen: | |
| # filename: infiniteradio.yml | |
| # GENERATED by scripts/generate.sh from infiniteradio.yml -- DO NOT EDIT. | |
| # Route bodies delegate to functions of the same name in app/handlers.py. | |
| from __future__ import annotations | |
| from fastapi import FastAPI | |
| from pydantic import conint | |
| from app import handlers | |
| from app.lifecycle import lifespan | |
| from .models import Style | |
| app = FastAPI( | |
| title='Infinite Radio', | |
| description='Endless generated music, steered by tempo and style parameters.', | |
| version='1.0', | |
| servers=[{'url': '/'}], | |
| lifespan=lifespan, | |
| ) | |
| async def get_player(): | |
| """ | |
| HTML page with an audio player for the stream. | |
| """ | |
| return await handlers.get_player() | |
| async def get_stream(): | |
| """ | |
| Continuous MP3 audio stream of the generated music. All listeners hear the same live stream. | |
| """ | |
| return await handlers.get_stream() | |
| async def post_style(body: Style): | |
| """ | |
| Post a value to set the style for future generated music. | |
| """ | |
| return await handlers.post_style(body) | |
| async def put_tempo(tempo: conint(ge=40, le=150)): | |
| """ | |
| Put a value to set the tempo of future generated music. | |
| """ | |
| return await handlers.put_tempo(tempo) | |