Spaces:
Sleeping
Sleeping
import os | |
from flask import Flask | |
from flask import jsonify | |
from flask import render_template | |
from flask import request | |
from modules.model import inference | |
app = Flask(__name__) | |
# app_dir = os.path.dirname(os.path.abspath(__file__)) | |
def index(js): | |
return render_template(f"{js}.html", js=js) | |
def predict(): | |
sample = os.getenv('SAMPLE_TEXT') | |
text = request.form.get('text', sample, type=str) | |
text = sample if text == "" else text | |
return jsonify(result=inference(text)) | |
if __name__ == "__main__": | |
app.run(debug = True) | |