21 lines
609 B
Python
21 lines
609 B
Python
|
#!flask/bin/python
|
||
|
from transformers import MBartForConditionalGeneration, MBart50TokenizerFast
|
||
|
from flask import Flask
|
||
|
from flask_restful import Api
|
||
|
|
||
|
|
||
|
from resources.video import Video
|
||
|
|
||
|
|
||
|
model = MBartForConditionalGeneration.from_pretrained("model-pl2en")
|
||
|
tokenizer = MBart50TokenizerFast.from_pretrained("model-pl2en", src_lang="pl_PL")
|
||
|
|
||
|
app = Flask(__name__)
|
||
|
api = Api(app)
|
||
|
|
||
|
api.add_resource(Video, '/api/video', resource_class_kwargs={'model': model,
|
||
|
'tokenizer': tokenizer})
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
app.run(debug=True, host='0.0.0.0')
|