Update app.py
Browse files
app.py
CHANGED
|
@@ -620,13 +620,13 @@ def updateColors(evt: gr.SelectData, seshid):
|
|
| 620 |
|
| 621 |
def makePalettes(evt: gr.SelectData, seshid):
|
| 622 |
sesh = getSesh(seshid)
|
| 623 |
-
|
| 624 |
sesh.img_id = sesh.current_img_signature = evt.value['caption'] if evt.value['caption'] else sesh.current_img_signature
|
| 625 |
if sesh.current_img_signature in sesh.Palettes_displayed:
|
| 626 |
display = updateItemDisplay(seshid)
|
| 627 |
print('makePalettes img sig in sesh.Palettes_displayed--returning: ', sesh.Palettes_displayed.keys())
|
| 628 |
return sesh.Palettes_displayed[sesh.current_img_signature], sesh.img_data[sesh.current_img_signature], display
|
| 629 |
-
|
| 630 |
img = sesh.img_data[sesh.img_id]
|
| 631 |
imgq = img // 48 * 48
|
| 632 |
Palette_out = []
|
|
@@ -646,7 +646,7 @@ def makePalettes(evt: gr.SelectData, seshid):
|
|
| 646 |
dark_light_bool = int(np.sum(counts_srtd_rgb)//12//128)
|
| 647 |
Palettes = {}
|
| 648 |
i = 0
|
| 649 |
-
|
| 650 |
#print('bestclr_keys: ', bestclr_keys)
|
| 651 |
url = 'https://dreamdemo.pythonanywhere.com/palletes'
|
| 652 |
#valid_data = {'seshid': str(sesh.seshid), 'img_id':str(sesh.img_id), 'dark_light_bool':str(dark_light_bool), 'bestclr_keys':bestclr_keys}
|
|
@@ -662,7 +662,7 @@ def makePalettes(evt: gr.SelectData, seshid):
|
|
| 662 |
print('makePalettes img sig was not in sesh.Palettes_displayed: ', sesh.Palettes_displayed.keys())
|
| 663 |
#print('\npalette json requests response: ', str(r.content), '\njson data: ', jsondata )
|
| 664 |
|
| 665 |
-
|
| 666 |
Palette_out = []
|
| 667 |
palettes_data = [cdata[0] for cdata in jsondata['got']]
|
| 668 |
sesh.palettes_data = {str(idx+1):cdata for idx,cdata in enumerate(palettes_data)}
|
|
@@ -686,7 +686,7 @@ def makePalettes(evt: gr.SelectData, seshid):
|
|
| 686 |
|
| 687 |
sesh.Palette_imgs[sesh.img_id] = sesh.Palette_img
|
| 688 |
display = updateItemDisplay(seshid)
|
| 689 |
-
|
| 690 |
sesh.Palettes_displayed[sesh.current_img_signature] = Palette_out
|
| 691 |
|
| 692 |
sesh.room_img_loaded = True
|
|
|
|
| 620 |
|
| 621 |
def makePalettes(evt: gr.SelectData, seshid):
|
| 622 |
sesh = getSesh(seshid)
|
| 623 |
+
print('makePalettes called: ')
|
| 624 |
sesh.img_id = sesh.current_img_signature = evt.value['caption'] if evt.value['caption'] else sesh.current_img_signature
|
| 625 |
if sesh.current_img_signature in sesh.Palettes_displayed:
|
| 626 |
display = updateItemDisplay(seshid)
|
| 627 |
print('makePalettes img sig in sesh.Palettes_displayed--returning: ', sesh.Palettes_displayed.keys())
|
| 628 |
return sesh.Palettes_displayed[sesh.current_img_signature], sesh.img_data[sesh.current_img_signature], display
|
| 629 |
+
print('makePalettes check1: ')
|
| 630 |
img = sesh.img_data[sesh.img_id]
|
| 631 |
imgq = img // 48 * 48
|
| 632 |
Palette_out = []
|
|
|
|
| 646 |
dark_light_bool = int(np.sum(counts_srtd_rgb)//12//128)
|
| 647 |
Palettes = {}
|
| 648 |
i = 0
|
| 649 |
+
print('makePalettes check2: ')
|
| 650 |
#print('bestclr_keys: ', bestclr_keys)
|
| 651 |
url = 'https://dreamdemo.pythonanywhere.com/palletes'
|
| 652 |
#valid_data = {'seshid': str(sesh.seshid), 'img_id':str(sesh.img_id), 'dark_light_bool':str(dark_light_bool), 'bestclr_keys':bestclr_keys}
|
|
|
|
| 662 |
print('makePalettes img sig was not in sesh.Palettes_displayed: ', sesh.Palettes_displayed.keys())
|
| 663 |
#print('\npalette json requests response: ', str(r.content), '\njson data: ', jsondata )
|
| 664 |
|
| 665 |
+
print('makePalettes check3: ')
|
| 666 |
Palette_out = []
|
| 667 |
palettes_data = [cdata[0] for cdata in jsondata['got']]
|
| 668 |
sesh.palettes_data = {str(idx+1):cdata for idx,cdata in enumerate(palettes_data)}
|
|
|
|
| 686 |
|
| 687 |
sesh.Palette_imgs[sesh.img_id] = sesh.Palette_img
|
| 688 |
display = updateItemDisplay(seshid)
|
| 689 |
+
print('makePalettes check4: ')
|
| 690 |
sesh.Palettes_displayed[sesh.current_img_signature] = Palette_out
|
| 691 |
|
| 692 |
sesh.room_img_loaded = True
|