woolbot's picture
fix
f626f92
raw
history blame
450 Bytes
from .utils import *
import asyncio
def apipredict(request):
try:
if request.method == 'POST': url = request.form['url']
else: url = request.args['url']
if url.strip() in ['', None]: raise Exception()
except: return {"status": "error", "details": { "error_code": 101, "error_details": "No link provided" }}
loop = asyncio.get_event_loop()
coroutine = predict(url)
return loop.run_until_complete(coroutine)