Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -508,7 +508,7 @@ def updateItemDisplay(seshid, budget=False):
|
|
| 508 |
url = 'https://dreamdemo.pythonanywhere.com/sesh'
|
| 509 |
data = sesh.__dict__
|
| 510 |
valid_data = {k:v for k,v in data.items() if k in keys and isJSONSerialiazable(v)}
|
| 511 |
-
valid_data['seshid'] = seshid
|
| 512 |
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
|
| 513 |
|
| 514 |
if True: #try:
|
|
@@ -781,7 +781,7 @@ def makePalettes(evt: gr.SelectData, seshid):
|
|
| 781 |
#print('makePalettes: ', type(evt.value), evt.value)
|
| 782 |
sesh.img_id = sesh.current_img_signature = evt.value['caption'] if evt.value['caption'] else sesh.current_img_signature
|
| 783 |
if sesh.current_img_signature in sesh.Palettes_displayed:
|
| 784 |
-
display = updateItemDisplay(seshid)
|
| 785 |
return sesh.Palettes_displayed[sesh.current_img_signature], sesh.img_data[sesh.current_img_signature], display
|
| 786 |
|
| 787 |
img = sesh.img_data[sesh.img_id]
|
|
@@ -807,8 +807,8 @@ def makePalettes(evt: gr.SelectData, seshid):
|
|
| 807 |
#print('bestclr_keys: ', bestclr_keys)
|
| 808 |
url = 'https://dreamdemo.pythonanywhere.com/palletes'
|
| 809 |
#valid_data = {'seshid': str(sesh.seshid), 'img_id':str(sesh.img_id), 'dark_light_bool':str(dark_light_bool), 'bestclr_keys':bestclr_keys}
|
| 810 |
-
|
| 811 |
-
valid_data = {'seshid': str(seshid), 'img_id':str(sesh.img_id), 'dark_light_bool':str(dark_light_bool), 'counts_srtd_rgb':counts_srtd_rgb}
|
| 812 |
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
|
| 813 |
#print('json requests response: ', str({k:(type(v), None if type(v) != type(dict({})) or not v else (type(list(v.items())[0][0]), type(list(v.items())[0][1]))) for k,v in valid_data.items()}))
|
| 814 |
#print('json requests response: ', str({k:(type(v), None if type(v) != type(dict({})) or not v else (type(list(v.items())[0][0]), type(list(v.items())[0][1]))) for k,v in data.items()}))
|
|
@@ -889,7 +889,7 @@ def makePalettes(evt: gr.SelectData, seshid):
|
|
| 889 |
sesh.Palette_img[150:,:] = palettes_data[0][3]
|
| 890 |
|
| 891 |
sesh.Palette_imgs[sesh.img_id] = sesh.Palette_img
|
| 892 |
-
display = updateItemDisplay(seshid)
|
| 893 |
|
| 894 |
sesh.Palettes_displayed[sesh.current_img_signature] = Palette_out
|
| 895 |
|
|
|
|
| 508 |
url = 'https://dreamdemo.pythonanywhere.com/sesh'
|
| 509 |
data = sesh.__dict__
|
| 510 |
valid_data = {k:v for k,v in data.items() if k in keys and isJSONSerialiazable(v)}
|
| 511 |
+
#valid_data['seshid'] = seshid
|
| 512 |
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
|
| 513 |
|
| 514 |
if True: #try:
|
|
|
|
| 781 |
#print('makePalettes: ', type(evt.value), evt.value)
|
| 782 |
sesh.img_id = sesh.current_img_signature = evt.value['caption'] if evt.value['caption'] else sesh.current_img_signature
|
| 783 |
if sesh.current_img_signature in sesh.Palettes_displayed:
|
| 784 |
+
display = updateItemDisplay(sesh.seshid)
|
| 785 |
return sesh.Palettes_displayed[sesh.current_img_signature], sesh.img_data[sesh.current_img_signature], display
|
| 786 |
|
| 787 |
img = sesh.img_data[sesh.img_id]
|
|
|
|
| 807 |
#print('bestclr_keys: ', bestclr_keys)
|
| 808 |
url = 'https://dreamdemo.pythonanywhere.com/palletes'
|
| 809 |
#valid_data = {'seshid': str(sesh.seshid), 'img_id':str(sesh.img_id), 'dark_light_bool':str(dark_light_bool), 'bestclr_keys':bestclr_keys}
|
| 810 |
+
valid_data = {'seshid': str(sesh.seshid), 'img_id':str(sesh.img_id), 'dark_light_bool':str(dark_light_bool), 'counts_srtd_rgb':counts_srtd_rgb}
|
| 811 |
+
#valid_data = {'seshid': str(seshid), 'img_id':str(sesh.img_id), 'dark_light_bool':str(dark_light_bool), 'counts_srtd_rgb':counts_srtd_rgb}
|
| 812 |
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
|
| 813 |
#print('json requests response: ', str({k:(type(v), None if type(v) != type(dict({})) or not v else (type(list(v.items())[0][0]), type(list(v.items())[0][1]))) for k,v in valid_data.items()}))
|
| 814 |
#print('json requests response: ', str({k:(type(v), None if type(v) != type(dict({})) or not v else (type(list(v.items())[0][0]), type(list(v.items())[0][1]))) for k,v in data.items()}))
|
|
|
|
| 889 |
sesh.Palette_img[150:,:] = palettes_data[0][3]
|
| 890 |
|
| 891 |
sesh.Palette_imgs[sesh.img_id] = sesh.Palette_img
|
| 892 |
+
display = updateItemDisplay(sesh.seshid)
|
| 893 |
|
| 894 |
sesh.Palettes_displayed[sesh.current_img_signature] = Palette_out
|
| 895 |
|