Spaces:
Runtime error
Runtime error
Commit ·
65ab00d
1
Parent(s): 947141a
Update app.py
Browse files2 unmodified lines3456789101112131415161718191 unmodified line2122232425262 unmodified linesimport osfrom dotenv import load_dotenvload_dotenv()app = flask.Flask(__name__, template_folder="./")from transformers import pipelineclassifier = pipeline('text-classification', model="bsenst/classify_services_model")@app.route('/')def index():return flask.render_template('index.html')@app.route("/", methods=["POST"])def predict():incoming = request.get_json()1 unmodified lineprediction = classifier(incoming["text"])[0]print(prediction)return predictionif __name__ == '__main__':app.run(host='0.0.0.0', port=int(os.environ.get('PORT', 7860)))2 unmodified lines345678910111213141 unmodified line1617181920212223242526272 unmodified linesimport osfrom dotenv import load_dotenvload_dotenv()app = flask.Flask(__name__, template_folder="./")from transformers import pipelineclassifier = pipeline('text-classification', model="bsenst/classify_services_model")@app.route('/')def index():return flask.render_template('index.html')@app.route("/", methods=["POST"])def predict():incoming = request.get_json()1 unmodified lineprediction = classifier(incoming["text"])[0]print(prediction)return prediction@app.route("/avp", methods=["POST"])def avp():incoming = request.get_json()print(incoming)# Обработка POST запроса по пути "/avp"# Можно добавить нужную логику для обработки данныхreturn "test ok 200"if __name__ == '__main__':app.run(host='0.0.0.0', port=int(os.environ.get('PORT', 7860)))
app.py+7-6