Spaces:
Runtime error
Runtime error
Update page/reduce.py
Browse files- page/reduce.py +5 -2
page/reduce.py
CHANGED
|
@@ -12,6 +12,7 @@ import requests
|
|
| 12 |
from io import BytesIO
|
| 13 |
from PIL import Image, ImageDraw
|
| 14 |
import base64
|
|
|
|
| 15 |
|
| 16 |
def dell(ix):
|
| 17 |
print("!!!!")
|
|
@@ -24,6 +25,8 @@ def app():
|
|
| 24 |
|
| 25 |
st.subheader('Choose which images you would like to remove from your working set.')
|
| 26 |
|
|
|
|
|
|
|
| 27 |
zipObj = zipfile.ZipFile('ai_architecture.zip', 'w')
|
| 28 |
|
| 29 |
deleteButtons = []
|
|
@@ -40,7 +43,7 @@ def app():
|
|
| 40 |
result['image'].save(output, format="JPEG")
|
| 41 |
contents = output.getvalue()
|
| 42 |
|
| 43 |
-
txt = result['prompt']+" (temperature:"+ str(result['crazy']) + ", top k:" + str(result['k']) + ")"
|
| 44 |
|
| 45 |
zipObj.writestr(txt+".jpg", contents )
|
| 46 |
|
|
@@ -56,7 +59,7 @@ def app():
|
|
| 56 |
st.download_button(
|
| 57 |
label="Download images as zip",
|
| 58 |
data=open('ai_architecture.zip', 'rb'),
|
| 59 |
-
file_name='ai_architecture.zip',
|
| 60 |
mime='application/zip'
|
| 61 |
)
|
| 62 |
|
|
|
|
| 12 |
from io import BytesIO
|
| 13 |
from PIL import Image, ImageDraw
|
| 14 |
import base64
|
| 15 |
+
import datetime
|
| 16 |
|
| 17 |
def dell(ix):
|
| 18 |
print("!!!!")
|
|
|
|
| 25 |
|
| 26 |
st.subheader('Choose which images you would like to remove from your working set.')
|
| 27 |
|
| 28 |
+
d = datetime.datetime.now()
|
| 29 |
+
|
| 30 |
zipObj = zipfile.ZipFile('ai_architecture.zip', 'w')
|
| 31 |
|
| 32 |
deleteButtons = []
|
|
|
|
| 43 |
result['image'].save(output, format="JPEG")
|
| 44 |
contents = output.getvalue()
|
| 45 |
|
| 46 |
+
txt = str(ix+1)+") " + result['prompt']+" (temperature:"+ str(result['crazy']) + ", top k:" + str(result['k']) + ")"
|
| 47 |
|
| 48 |
zipObj.writestr(txt+".jpg", contents )
|
| 49 |
|
|
|
|
| 59 |
st.download_button(
|
| 60 |
label="Download images as zip",
|
| 61 |
data=open('ai_architecture.zip', 'rb'),
|
| 62 |
+
file_name='ai_architecture '+d.strftime("%m-%d-%Y")+'.zip',
|
| 63 |
mime='application/zip'
|
| 64 |
)
|
| 65 |
|