DmitrMakeev commited on
Commit
10321f6
·
1 Parent(s): 65ab00d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -8
app.py CHANGED
@@ -3,12 +3,17 @@ from flask import request
3
  import os
4
  from dotenv import load_dotenv
5
  load_dotenv()
 
6
  app = flask.Flask(__name__, template_folder="./")
 
7
  from transformers import pipeline
 
8
  classifier = pipeline('text-classification', model="bsenst/classify_services_model")
 
9
  @app.route('/')
10
  def index():
11
  return flask.render_template('index.html')
 
12
  @app.route("/", methods=["POST"])
13
  def predict():
14
  incoming = request.get_json()
@@ -16,12 +21,6 @@ def predict():
16
  prediction = classifier(incoming["text"])[0]
17
  print(prediction)
18
  return prediction
19
- @app.route("/avp", methods=["POST"])
20
- def avp():
21
- incoming = request.get_json()
22
- print(incoming)
23
- # Обработка POST запроса по пути "/avp"
24
- # Можно добавить нужную логику для обработки данных
25
- return "test ok 200"
26
  if __name__ == '__main__':
27
- app.run(host='0.0.0.0', port=int(os.environ.get('PORT', 7860)))
 
3
  import os
4
  from dotenv import load_dotenv
5
  load_dotenv()
6
+
7
  app = flask.Flask(__name__, template_folder="./")
8
+
9
  from transformers import pipeline
10
+
11
  classifier = pipeline('text-classification', model="bsenst/classify_services_model")
12
+
13
  @app.route('/')
14
  def index():
15
  return flask.render_template('index.html')
16
+
17
  @app.route("/", methods=["POST"])
18
  def predict():
19
  incoming = request.get_json()
 
21
  prediction = classifier(incoming["text"])[0]
22
  print(prediction)
23
  return prediction
24
+
 
 
 
 
 
 
25
  if __name__ == '__main__':
26
+ app.run(host='0.0.0.0', port=int(os.environ.get('PORT', 7860)))