Spaces:
Runtime error
Runtime error
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) |