-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.py
35 lines (29 loc) · 1.05 KB
/
app.py
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
31
32
33
34
35
from flask import Flask, request, redirect
from twilio.twiml.messaging_response import MessagingResponse,Message
from twilio.rest import Client
from controller.util import driver
app = Flask(__name__)
client_SID = "AC07b717405115f000412bae282aaead25"
authToken = "838103e493ea531ac1c669f88c3efa81"
def disease():
nv= 'Melanocytic nevi (nv)'
mel= 'Melanoma (mel)'
bkl= 'Benign keratosis-like lesions (bkl)'
bcc= 'Basal cell carcinoma (bcc)'
akiec= 'Actinic keratoses (akiec'
vasc= 'Vascular lesions (vasc)'
df='Dermatofibroma (df)'
client = Client(client_SID,authToken)
@app.route("/bot",methods=["POST"])
def bot():
sender = request.values.get("From")
if request.values['NumMedia'] != '0' :
img_url = request.values['MediaUrl0']
body = driver(img_url)
else:
body="Please upload a *single* image of the affected area"
message = client.messages.create(to=sender,from_="whatsapp:+14155238886",body=body)
# print(resp)
return str(message)
if __name__=="__main__":
app.run(debug=True)