ChefGen / main.py
AndriiPets's picture
initial
579fc35
raw
history blame
650 Bytes
from flask import Flask
from generator import generation_function
from flask import request
from flask_cors import CORS
import asyncio
app = Flask(__name__)
CORS(app)
@app.route('/')
def hello():
return 'Hello world!'
@app.route('/generate', methods=['POST'])
def generate():
request_data = request.get_json()
text = request_data["prompts"]
if request_data.get("lang"):
generated_recepie = generation_function(
text, lang=request_data["lang"])
else:
generated_recepie = generation_function(text)
return generated_recepie
if __name__ == '__main__':
app.run(host="0.0.0.0", port=7860)