Staticaliza commited on
Commit
3030c98
·
verified ·
1 Parent(s): e564e9e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -9
app.py CHANGED
@@ -133,19 +133,17 @@ def generate(input=DEFAULT_INPUT, filter_input="", negative_input=DEFAULT_NEGATI
133
 
134
  print(nsfw_prediction)
135
 
136
- image = images[0].convert("RGBA")
137
- image = image.resize((width, height))
138
- json_data = []
139
 
140
- for x in range(image.width):
141
- json_data.append([])
142
- for y in range(image.height):
143
  r, g, b, a = image.getpixel((x, y))
144
- json_data[x].append([r, g, b, a])
145
 
146
- json_string = json.dumps(json_data)
147
 
148
- return image_paths, {item['label']: round(item['score'], 3) for item in nsfw_prediction}, json_string
149
 
150
  def cloud():
151
  print("[CLOUD] | Space maintained.")
 
133
 
134
  print(nsfw_prediction)
135
 
136
+ image = images[0].convert("RGBA").resize((width, height))
137
+ buffer_data = []
 
138
 
139
+ for y in range(height):
140
+ for x in range(width):
 
141
  r, g, b, a = image.getpixel((x, y))
142
+ buffer_data.extend([r, g, b, a])
143
 
144
+ buffer_json = json.dumps(buffer_data)
145
 
146
+ return image_paths, {item['label']: round(item['score'], 3) for item in nsfw_prediction}, buffer_json
147
 
148
  def cloud():
149
  print("[CLOUD] | Space maintained.")