Spaces:
Sleeping
Sleeping
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) | |
def hello(): | |
return 'Hello world!' | |
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) | |