binqiangliu commited on
Commit
c5ffb47
·
1 Parent(s): d4bfb62

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -12
app.py CHANGED
@@ -6,21 +6,17 @@ 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()
20
  print(incoming)
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)))
 
6
 
7
  app = flask.Flask(__name__, template_folder="./")
8
 
 
 
 
 
9
  @app.route('/')
10
  def index():
11
  return flask.render_template('index.html')
12
+
13
+ app = Flask(__name__)
14
+ @app.route('/api/chat', methods=['POST'])
15
+ def chat():
16
  incoming = request.get_json()
17
  print(incoming)
18
+ initial_response="hello"
19
+ return jsonify({'response': initial_response})
20
+
 
21
  if __name__ == '__main__':
22
+ app.run(host='0.0.0.0', port=int(os.environ.get('PORT', 7860)))