Spaces:
Runtime error
Runtime error
Download upload.py from Mr-profik/Meta-Video: direct link, hf CLI and curl.
- Browser
- Download file 568 Bytes
-
https://huggingface.co/spaces/Mr-profik/Meta-Video/resolve/main/upload.py
- Command line
-
hf download hf://spaces/Mr-profik/Meta-Video/upload.py
-
curl -L -o upload.py https://huggingface.co/spaces/Mr-profik/Meta-Video/resolve/main/upload.py
568 Bytes
| import os | |
| from flask import Blueprint, request, jsonify | |
| from models import Video | |
| from database import db | |
| upload_bp = Blueprint("upload", __name__) | |
| UPLOAD_FOLDER = "uploads" | |
| os.makedirs(UPLOAD_FOLDER, exist_ok=True) | |
| def upload(): | |
| file = request.files["file"] | |
| title = request.form.get("title") | |
| path = os.path.join(UPLOAD_FOLDER, file.filename) | |
| file.save(path) | |
| video = Video(title=title, filename=file.filename) | |
| db.session.add(video) | |
| db.session.commit() | |
| return jsonify({"message": "uploaded"}) |