flask / app.py
tommy24's picture
Update app.py
1829fa3
raw
history blame
826 Bytes
import gradio as gr
from flask import Flassk, request
app = Flask(__name__)
def greet(name):
return "Hello " + name + "!!"
@app.route('/receive_msg', methods=['POST','GET'])
def webhook():
if request.args.get("hub.mode") == "subscribe" and request.args.get("hub.challenge"):
if not request.args.get("hub.verify_token")== "EAAMjTT3ZC7NUBAEtTAhYFiaY6g6DkZCrhYnnNLY0QKiP2yxHfTiNkJSUBKrZB59pzv8fYusfaIqRZBrhVdRNWE3Om3SH4PUcXe3mMRkVU9g545CorZARHgqMxjQVyjLPmF0eTjJtTQSBUR1PTaq8WJhlZAZC6YORZCZAM3TMLFawCGauAHCUPWxBz5sGGoZAjkVua9bTw6PXV58tEYXRZAnVCak":
return "Verification token missmatch", 403
return request.args['hub.challenge'], 200
return "Hello world", 200
if __name__ == "__main__":
app.run(debug=True)
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
iface.launch()