File size: 870 Bytes
f1d9208
 
 
 
 
 
 
 
 
db15717
f1d9208
db15717
 
f1d9208
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import flask
from flask import Flask, request, jsonify
import os
from dotenv import load_dotenv
load_dotenv()

app = flask.Flask(__name__, template_folder="./")

@app.route('/')
#@app.route('/', methods=['POST'])
def index():
    return flask.render_template('index.html')  
#    return {"Message":"Flask Home API Deploy Success on HF"}      

#app = Flask(__name__)
@app.route('/api/chat', methods=['POST'])
def chat():
    data = request.get_json()
    user_query = data['user_question']    
    print(user_query)    
    initial_response="hello"    
    #return jsonify({'response': initial_response})
    return {'response': initial_response}
#Working!!!    
     
if __name__ == '__main__':
    #app.run(host='0.0.0.0',  port=int(os.environ.get('PORT', 7860)))
    #app.run(host='0.0.0.0',  port=7860)    
    app.run(host='0.0.0.0',  port=7860)
#Working!!!