Download OneApi/api/host.py from dragxd/oneapi: direct link, hf CLI and curl.
- Browser
- Download file 712 Bytes
-
https://huggingface.co/spaces/dragxd/oneapi/resolve/main/OneApi/api/host.py
- Command line
-
hf download hf://spaces/dragxd/oneapi/OneApi/api/host.py
-
curl -L -o host.py https://huggingface.co/spaces/dragxd/oneapi/resolve/main/OneApi/api/host.py
712 Bytes
| from ..database import * | |
| from quart import * | |
| import logging | |
| from .. import * | |
| from ..deployment.deployment import Deployment | |
| user = user() | |
| deploy = Deployment() | |
| host_bp = Blueprint('host', __name__) | |
| async def host(): | |
| data = await request.get_json() | |
| if not data or not 'user_id' in data and not 'project_id' in data: return jsonify({'error': 'missing user_id or project_id'}), 400 | |
| user_id = int(data.get('user_id')) | |
| project_id = int(data.get('project_id')) | |
| mm = await deploy.host(user_id, project_id) | |
| logging.info(f"DEBUG HOST API 18: {mm}") | |
| if mm is True: | |
| return jsonify({'message': 'Successfully hosted!'}), 200 | |
| return jsonify({'message': mm}), 400 | |