from flask import Flask
from flask import request
from flask import render_template
from flask import redirect
from flask import jsonify
from flask import send_from_directory
import json
import numpy as np
import moduli
#from hugchat import hugchat
#from hugchat.login import Login
from numpy.linalg import norm
import datetime
import tensorflow as tf
import tensorflow_hub as hub
import tensorflow_text
from functools import wraps
import os
import pickle
model_url = "./hub_model/"
hub_layer = hub.load(model_url)
app = Flask(__name__)
def support_jsonp(func):
"""Wraps JSONified output for JSONP requests."""
@wraps(func)
def decorated_function(*args, **kwargs):
callback = request.args.get('callback', False)
if callback:
resp = func(*args, **kwargs)
resp.set_data('{}({})'.format(
str(callback),
resp.get_data(as_text=True)
))
resp.mimetype = 'application/javascript'
return resp
else:
return func(*args, **kwargs)
return decorated_function
@app.route("/")
def flask_app():
return '
' \
'