Download main.py from KozaKoza/test: direct link, hf CLI and curl.
- Browser
- Download file 886 Bytes
-
https://huggingface.co/KozaKoza/test/resolve/main/main.py
- Command line
-
hf download hf://KozaKoza/test/main.py
-
curl -L -o main.py https://huggingface.co/KozaKoza/test/resolve/main/main.py
886 Bytes
| from flask import Flask | |
| from flask_restx import Api, Resource, fields | |
| from werkzeug.datastructures import FileStorage | |
| import wav2vec2 as wave | |
| flask_app = Flask(__name__) | |
| app = Api(app = flask_app, | |
| version="1.0", | |
| title="Model deployment test", | |
| description="Test your models and feel rad") | |
| upload_parser = app.parser() | |
| upload_parser.add_argument('file', | |
| location='files', | |
| type=FileStorage) | |
| model = app.model('Soundfile', | |
| {'name': fields.String(required = True, | |
| description="The soudnfile you want to decode", | |
| help="File is necessary")}) | |
| class Transcribe(Resource): | |
| def post(self): | |
| args = upload_parser.parse_args() | |
| file = args.get('file') | |
| text = wave.predict(file) | |
| return text |