-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.py
564 lines (497 loc) · 24.3 KB
/
server.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
import os, sys, platform, subprocess
import os.path
from os import path
import pandas as pd
import random
os.chdir(os.getcwd())
bot_dir = 'python_bot-master'
sys.path.append(bot_dir)
from Updater import Updater
def outfitSameColor(bot, chat_id):
global matlab_function_dir
global group
global color
image_dir = "..\\trainSet\\"
kid = [1, 4, 8, 15, 22];
top = [2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 16, 17, 18, 19, 20, 21];
bottom = [23, 24, 25, 28, 29, 30, 31, 32, 33, 34];
underwear = [26, 27];
footwear = [35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50];
groupChoice = []
if group in kid:
groupNot = top + bottom + underwear + footwear
groupChoice.append(random.choice(kid))
elif group in top:
groupNot = top + kid
groupChoice.append(random.choice(bottom))
groupChoice.append(random.choice(underwear))
groupChoice.append(random.choice(footwear))
elif group in bottom:
groupNot = bottom + kid
groupChoice.append(random.choice(top))
groupChoice.append(random.choice(underwear))
groupChoice.append(random.choice(footwear))
elif group in underwear:
groupNot = underwear + kid
groupChoice.append(random.choice(bottom))
groupChoice.append(random.choice(top))
groupChoice.append(random.choice(footwear))
else:
groupNot = footwear + kid
groupChoice.append(random.choice(bottom))
groupChoice.append(random.choice(underwear))
groupChoice.append(random.choice(top))
dataByColor = pd.read_csv(matlab_function_dir + '\\color.csv',header=0,
names=['image', 'color'])
imageOfRightColor = dataByColor.loc[dataByColor['color']==color]
groups = pd.read_csv('..\\train.csv')
imageOfRightGroup = groups.loc[~groups['group'].isin(groupNot)]
selectedImage = imageOfRightGroup.loc[imageOfRightGroup['name'].isin(imageOfRightColor['image'])]
nameSelectedImages = []
for i in groupChoice:
if i in selectedImage['group'].tolist():
tmp = selectedImage.loc[selectedImage['group']==i]
imChoosed = tmp.sample()
nameImChoosed = imChoosed.iloc[0]['name']
nameSelectedImages.append(str(nameImChoosed))
if len(nameSelectedImages) > 0:
for j in range(len(nameSelectedImages)-1):
bot.sendImage(chat_id, image_dir + nameSelectedImages[j], "")
bot.sendImage(chat_id, image_dir + nameSelectedImages[-1], "I hope you like this outfit! See you soon!")
Last_message_send = ""
else:
bot.sendMessage(chat_id, "I'm sorry, but I don't find a good outfit. Please try with a new image !")
Last_message_send = "Please, try a new image!"
def outfitSameTexture(bot, chat_id):
global matlab_function_dir
global group
global texture
image_dir = "..\\trainSet\\"
kid = [1, 4, 8, 15, 22];
top = [2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 16, 17, 18, 19, 20, 21];
bottom = [23, 24, 25, 28, 29, 30, 31, 32, 33, 34];
underwear = [26, 27];
footwear = [35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50];
groupChoice = []
if group in kid:
groupNot = top + bottom + underwear + footwear
groupChoice.append(random.choice(kid))
elif group in top:
groupNot = top + kid
groupChoice.append(random.choice(bottom))
groupChoice.append(random.choice(underwear))
groupChoice.append(random.choice(footwear))
elif group in bottom:
groupNot = bottom + kid
groupChoice.append(random.choice(top))
groupChoice.append(random.choice(underwear))
groupChoice.append(random.choice(footwear))
elif group in underwear:
groupNot = underwear + kid
groupChoice.append(random.choice(bottom))
groupChoice.append(random.choice(top))
groupChoice.append(random.choice(footwear))
else:
groupNot = footwear + kid
groupChoice.append(random.choice(bottom))
groupChoice.append(random.choice(underwear))
groupChoice.append(random.choice(top))
dataByText = pd.read_csv(matlab_function_dir + '\\texture.csv',header=0,
names=['image', 'texture'])
imageOfRightText = dataByText.loc[dataByText['texture']==texture]
groups = pd.read_csv('..\\train.csv')
imageOfRightGroup = groups.loc[~groups['group'].isin(groupNot)]
selectedImage = imageOfRightGroup.loc[imageOfRightGroup['name'].isin(imageOfRightText['image'])]
nameSelectedImages = []
for i in groupChoice:
if i in selectedImage['group'].tolist():
tmp = selectedImage.loc[selectedImage['group']==i]
imChoosed = tmp.sample()
nameImChoosed = imChoosed.iloc[0]['name']
nameSelectedImages.append(str(nameImChoosed))
if len(nameSelectedImages) > 0:
for j in range(len(nameSelectedImages)-1):
bot.sendImage(chat_id, image_dir + nameSelectedImages[j], "")
bot.sendImage(chat_id, image_dir + nameSelectedImages[-1], "I hope you like this outfit! See you soon!")
Last_message_send = ""
else:
bot.sendMessage(chat_id, "I'm sorry, but I don't find a good outfit. Please try with a new image !")
Last_message_send = "Please, try a new image!"
def outfitBoth(bot, chat_id):
global matlab_function_dir
global group
global color
global texture
image_dir = "..\\trainSet\\"
kid = [1, 4, 8, 15, 22];
top = [2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 16, 17, 18, 19, 20, 21];
bottom = [23, 24, 25, 28, 29, 30, 31, 32, 33, 34];
underwear = [26, 27];
footwear = [35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50];
groupChoice = []
if group in kid:
groupNot = top + bottom + underwear + footwear
groupChoice.append(random.choice(kid))
elif group in top:
groupNot = top + kid
groupChoice.append(random.choice(bottom))
groupChoice.append(random.choice(underwear))
groupChoice.append(random.choice(footwear))
elif group in bottom:
groupNot = bottom + kid
groupChoice.append(random.choice(top))
groupChoice.append(random.choice(underwear))
groupChoice.append(random.choice(footwear))
elif group in underwear:
groupNot = underwear + kid
groupChoice.append(random.choice(bottom))
groupChoice.append(random.choice(top))
groupChoice.append(random.choice(footwear))
else:
groupNot = footwear + kid
groupChoice.append(random.choice(bottom))
groupChoice.append(random.choice(underwear))
groupChoice.append(random.choice(top))
dataByText = pd.read_csv(matlab_function_dir + '\\texture.csv',header=0,
names=['image', 'texture'])
imageOfRightText = dataByText.loc[dataByText['texture']==texture]
dataByColor = pd.read_csv(matlab_function_dir + '\\color.csv',header=0,
names=['image', 'color'])
imageOfRightColor = dataByColor.loc[dataByColor['color']==color]
groups = pd.read_csv('..\\train.csv')
imageOfRightGroup = groups.loc[~groups['group'].isin(groupNot)]
selectedImage = imageOfRightGroup.loc[imageOfRightGroup['name'].isin(imageOfRightText['image']) & imageOfRightGroup['name'].isin(imageOfRightColor['image'])]
nameSelectedImages = []
for i in groupChoice:
if i in selectedImage['group'].tolist():
tmp = selectedImage.loc[selectedImage['group']==i]
imChoosed = tmp.sample()
nameImChoosed = imChoosed.iloc[0]['name']
nameSelectedImages.append(str(nameImChoosed))
if len(nameSelectedImages) > 0:
for j in range(len(nameSelectedImages)-1):
bot.sendImage(chat_id, image_dir + nameSelectedImages[j], "")
bot.sendImage(chat_id, image_dir + nameSelectedImages[-1], "I hope you like this outfit! See you soon!")
Last_message_send = ""
else:
bot.sendMessage(chat_id, "I'm sorry, but I don't find a good outfit. Please try with a new image !")
Last_message_send = "Please, try a new image!"
def classifyClothes(bot, message, chat_id, filename):
global Last_message_send
global cur_dir
global matlab_function_dir
global matlab_cmd
global group
#Set command to start matlab script "classification.m"
cmd_classification = matlab_cmd + " -nodesktop -nosplash -wait -r \"addpath(\'" + matlab_function_dir + "\'); classification(\'" + filename + "\'); quit\""
#Launch command
subprocess.call(cmd_classification,shell=True)
f3 = open(cur_dir + "\\label.txt", "r")
label = f3.read()
bot.sendMessage(chat_id, label)
Last_message_send = "Check clothes"
f3.close()
f3b = open(cur_dir + "\\labelNum.txt", "r")
group = int(f3b.read())
f3b.close()
def detectColor(bot, message, chat_id, filename):
global Last_message_send
global cur_dir
global matlab_function_dir
global matlab_cmd
global color
#Set command to start matlab script "getColor.m"
cmd_classification = matlab_cmd + " -nodesktop -nosplash -wait -r \"addpath(\'" + matlab_function_dir + "\'); getColor(\'" + filename + "\'); quit\""
#Launch command
subprocess.call(cmd_classification,shell=True)
f4 = open(cur_dir + "\\color.txt", "r")
colorString = f4.read()
bot.sendMessage(chat_id, colorString)
Last_message_send = "Check color"
f4.close()
f4b = open(cur_dir + "\\colorNum.txt", "r")
color = int(f4b.read())
f4b.close()
def detectTexture(bot, message, chat_id, filename):
global Last_message_send
global cur_dir
global matlab_function_dir
global matlab_cmd
global texture
#Set command to start matlab script "textureRecognition.m"
cmd_texture = matlab_cmd + " -nodesktop -nosplash -wait -r \"addpath(\'" + matlab_function_dir + "\'); textureRecognition(\'" + filename + "\', 0); quit\""
subprocess.call(cmd_texture,shell=True)
f5 = open(cur_dir + "\\texture.txt", "r")
text = f5.read()
bot.sendMessage(chat_id, text)
Last_message_send = "Check texture"
f5.close()
f5b = open(cur_dir + "\\textureVal.txt", "r")
texture = f5b.read()
f5b.close()
def fileparts(fn):
(dirName, fileName) = os.path.split(fn)
(fileBaseName, fileExtension) = os.path.splitext(fileName)
return dirName, fileBaseName, fileExtension
def imageHandler(bot, message, chat_id, local_filename):
global cur_dir
global matlab_function_dir
global Last_message_send
global current_image_name
global matlab_cmd
print(local_filename)
current_image_name = local_filename
cur_dir = os.path.dirname(os.path.realpath(__file__))
matlab_function_dir = cur_dir + "\MatLab_functions"
# Set matlab command
if 'Linux' in platform.system():
matlab_cmd = '/usr/local/bin/matlab'
else:
matlab_cmd = '"C:\\Program Files\\MATLAB\\R2020b\\bin\\matlab.exe"'
#Send message to user
bot.sendMessage(chat_id, "Hi, please wait until we tell you if the image is processable.")
Last_message_send = "Hi, please wait until we tell you if the image is processable."
#Set command to start matlab script "isBlurry.m"
cmd_blur = matlab_cmd + " -nodesktop -nosplash -wait -r \"addpath(\'" + matlab_function_dir + "\'); isBlurry(\'" + local_filename + "\', 15, 0); quit\""
#Launch command
subprocess.call(cmd_blur,shell=True)
#Set command to start matlab script "isBright.m"
cmd_bright = matlab_cmd + " -nodesktop -nosplash -wait -r \"addpath(\'" + matlab_function_dir + "\'); isBright(\'" + local_filename + "\', 0); quit\""
#Launch command
subprocess.call(cmd_bright,shell=True)
#Set command to start matlab script "isNoisy.m"
cmd_noise = matlab_cmd + " -nodesktop -nosplash -wait -r \"addpath(\'" + matlab_function_dir + "\'); isNoisy(\'" + local_filename + "\', 0); quit\""
#Launch command
subprocess.call(cmd_noise,shell=True)
f = open(cur_dir + "\\messages.txt", "r")
message = f.read()
f.close()
f2 = open(cur_dir + "\\booleanAccepted.txt", "r")
boolean = f2.read()
f2.close()
accepted = False
if("1" not in boolean):
accepted = True
#send the response
bot.sendMessage(chat_id, message)
Last_message_send = message
if(accepted):
bot.sendMessage(chat_id, "Your image is going to be classified.")
Last_message_send = "Your image is going to be classified."
classifyClothes(bot, message, chat_id, local_filename)
else:
bot.sendMessage(chat_id, "Your image can not be processed. Do you want me to try to correct it ?")
Last_message_send = "Your image can not be processed. Do you want me to try to correct it ?"
def textHandler(bot, message, chat_id, text):
global Last_message_send
global current_image_name
global color
global texture
YES = ["yes", "Yes", "y", "Y"]
print(text)
if text == "help" or text == "Help":
bot.sendMessage(chat_id, "Send me an image, and follow my instructions!\n"+
"To answer yes to a question, you can say 'Yes', 'yes', 'Y', or 'y'.\nTo answer no, you can send 'No', 'no', 'N', 'n', or anything else.")
if Last_message_send == "":
bot.sendMessage(chat_id, "Hi, please send me an image!")
elif Last_message_send == "So please, try a new image!" or Last_message_send == "Please, try a new image!":
bot.sendMessage(chat_id, "Please, try a new image!")
Last_message_send = "Please, try a new image!"
elif Last_message_send == "Your image can not be processed. Do you want me to try to correct it ?":
if text in YES:
bot.sendMessage(chat_id, "Ok, please wait until I've finish to correct your image.")
Last_message_send = "Ok, please wait until I've finish to correct your image."
cmd_correction = matlab_cmd + " -nodesktop -nosplash -wait -r \"addpath(\'" + matlab_function_dir + "\'); correction(\'" + current_image_name + "\'); quit\""
sub = subprocess.call(cmd_correction, shell=True)
if path.exists("Corrected.jpg") :
bot.sendImage(chat_id, "Corrected.jpg", "This is your image corrected. Do you agree with this correction ?")
Last_message_send = "This is your image corrected. Do you agree with this correction ?"
else:
bot.sendMessage(chat_id, "I'm really sorry, I cannot correct this image. Please, try a new one!")
Last_message_send = "So please, try a new image!"
os.remove(current_image_name)
os.remove("booleanAccepted.txt")
os.remove("messages.txt")
else:
bot.sendMessage(chat_id, "So please, try a new image!")
Last_message_send = "So please, try a new image!"
os.remove(current_image_name)
os.remove("booleanAccepted.txt")
os.remove("messages.txt")
elif Last_message_send == "This is your image corrected. Do you agree with this correction ?":
if text in YES:
bot.sendMessage(chat_id, "The image is going to be classified.")
Last_message_send = "The image is going to be classified."
os.remove(current_image_name)
current_image_name = "Corrected.jpg"
classifyClothes(bot, message, chat_id, "Corrected.jpg")
else:
bot.sendMessage(chat_id, "So please, try a new image!")
Last_message_send = "So please, try a new image!"
os.remove(current_image_name)
os.remove("booleanAccepted.txt")
os.remove("messages.txt")
os.remove("Corrected.jpg")
elif Last_message_send == "Check clothes":
if text in YES:
detectColor(bot, message, chat_id, current_image_name)
else:
bot.sendMessage(chat_id, "I'm sorry about this error... Please, try with another image")
Last_message_send = "Please, try a new image!"
os.remove(current_image_name)
os.remove("booleanAccepted.txt")
os.remove("messages.txt")
os.remove("label.txt")
os.remove("labelNum.txt")
elif Last_message_send == "Check color":
if text in YES:
detectTexture(bot, message, chat_id, current_image_name)
else:
bot.sendMessage(chat_id, "I'm sorry about this error... Can you please tell me what is the right color?\n"+
"Type 1 for black, 2 for blue, 3 for brown, 4 for green, 5 for grey, 6 for orange, 7 for pink, 8 for purple,"+
"9 for red, 10 for white or 11 for yellow.")
Last_message_send = "Color?"
elif Last_message_send == "Color?":
if text == "1":
color = 1
detectTexture(bot, message, chat_id, current_image_name)
elif text == "2":
color = 2
detectTexture(bot, message, chat_id, current_image_name)
elif text == "3":
color = 3
detectTexture(bot, message, chat_id, current_image_name)
elif text == "4":
color = 4
detectTexture(bot, message, chat_id, current_image_name)
elif text == "5":
color = 5
detectTexture(bot, message, chat_id, current_image_name)
elif text == "6":
color = 6
detectTexture(bot, message, chat_id, current_image_name)
elif text == "7":
color = 7
detectTexture(bot, message, chat_id, current_image_name)
elif text == "8":
color = 8
detectTexture(bot, message, chat_id, current_image_name)
elif text == "9":
color = 9
detectTexture(bot, message, chat_id, current_image_name)
elif text == "10":
color = 10
detectTexture(bot, message, chat_id, current_image_name)
elif text == "11":
color = 11
detectTexture(bot, message, chat_id, current_image_name)
else:
bot.sendMessage(chat_id, "I'm sorry, but I cannot understand your response. Please, retry!")
Last_message_send = "Color?"
elif Last_message_send == "Check texture":
if text in YES:
bot.sendMessage(chat_id, "Perfect! Just one last question and I'll suggest an outfit!\n"+
"Do you want an outfit with the same color (type 1), the same texture (type 2) or both (type 3)?")
Last_message_send = "kind of outfit?"
else:
bot.sendMessage(chat_id, "I'm sorry about this error... Can you please tell me what is the right texture?\n"+
"Type 1 for acrylic, 2 for corduroy, 3 for cotton, 4 for denim, 5 for leather, 6 for nylon, 7 for polyester, 8 for satin,"+
"or 9 for viscose.")
Last_message_send = "Texture?"
elif Last_message_send == "Texture?":
if text == "1":
texture = "Acrylic"
bot.sendMessage(chat_id, "Perfect! Just one last question and I'll suggest an outfit!\n"+
"Do you want an outfit with the same color (type 1), the same texture (type 2) or both (type 3)?")
Last_message_send = "kind of outfit?"
elif text == "2":
texture = "Corduroy"
bot.sendMessage(chat_id, "Perfect! Just one last question and I'll suggest an outfit!\n"+
"Do you want an outfit with the same color (type 1), the same texture (type 2) or both (type 3)?")
Last_message_send = "kind of outfit?"
elif text == "3":
texture = "Cotton"
bot.sendMessage(chat_id, "Perfect! Just one last question and I'll suggest an outfit!\n"+
"Do you want an outfit with the same color (type 1), the same texture (type 2) or both (type 3)?")
Last_message_send = "kind of outfit?"
elif text == "4":
texture = "Denim"
bot.sendMessage(chat_id, "Perfect! Just one last question and I'll suggest an outfit!\n"+
"Do you want an outfit with the same color (type 1), the same texture (type 2) or both (type 3)?")
Last_message_send = "kind of outfit?"
elif text == "5":
texture = "Leather"
bot.sendMessage(chat_id, "Perfect! Just one last question and I'll suggest an outfit!\n"+
"Do you want an outfit with the same color (type 1), the same texture (type 2) or both (type 3)?")
Last_message_send = "kind of outfit?"
elif text == "6":
texture = "Nylon"
bot.sendMessage(chat_id, "Perfect! Just one last question and I'll suggest an outfit!\n"+
"Do you want an outfit with the same color (type 1), the same texture (type 2) or both (type 3)?")
Last_message_send = "kind of outfit?"
elif text == "7":
texture = "Polyester"
bot.sendMessage(chat_id, "Perfect! Just one last question and I'll suggest an outfit!\n"+
"Do you want an outfit with the same color (type 1), the same texture (type 2) or both (type 3)?")
Last_message_send = "kind of outfit?"
elif text == "8":
texture = "Satin"
bot.sendMessage(chat_id, "Perfect! Just one last question and I'll suggest an outfit!\n"+
"Do you want an outfit with the same color (type 1), the same texture (type 2) or both (type 3)?")
Last_message_send = "kind of outfit?"
elif text == "9":
texture = "Viscose"
bot.sendMessage(chat_id, "Perfect! Just one last question and I'll suggest an outfit!\n"+
"Do you want an outfit with the same color (type 1), the same texture (type 2) or both (type 3)?")
Last_message_send = "kind of outfit?"
else:
bot.sendMessage(chat_id, "I'm sorry, but I cannot understand your response. Please, retry!")
Last_message_send = "Texture?"
elif Last_message_send == "kind of outfit?":
if text == "1":
outfitSameColor(bot, chat_id)
os.remove(current_image_name)
os.remove("booleanAccepted.txt")
os.remove("messages.txt")
os.remove("label.txt")
os.remove("labelNum.txt")
os.remove("color.txt")
os.remove("colorNum.txt")
os.remove("texture.txt")
os.remove("textureVal.txt")
elif text == "2":
outfitSameTexture(bot, chat_id)
os.remove(current_image_name)
os.remove("booleanAccepted.txt")
os.remove("messages.txt")
os.remove("label.txt")
os.remove("labelNum.txt")
os.remove("color.txt")
os.remove("colorNum.txt")
os.remove("texture.txt")
os.remove("textureVal.txt")
elif text == "3":
outfitBoth(bot, chat_id)
os.remove(current_image_name)
os.remove("booleanAccepted.txt")
os.remove("messages.txt")
os.remove("label.txt")
os.remove("labelNum.txt")
os.remove("color.txt")
os.remove("colorNum.txt")
os.remove("texture.txt")
os.remove("textureVal.txt")
else:
bot.sendMessage(chat_id, "I'm sorry, but I cannot understand your response. Please, retry!")
Last_message_send = "kind of outfit?"
else:
bot.sendMessage(chat_id, "Please wait until your image finish to be processed.")
Last_message_send = "Please wait until your image finish to be processed."
if __name__ == "__main__":
global Last_message_send
Last_message_send = ""
bot_id = '1461723734:AAFTgtj7DCKmhBOi6svlNTtuqmYBSnHp5I4'
updater = Updater(bot_id)
updater.setPhotoHandler(imageHandler)
updater.setTextHandler(textHandler)
updater.start()