nightfury commited on
Commit
59cddce
1 Parent(s): 1d197f7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -128,8 +128,8 @@ def predict(radio, dict, word_mask, prompt=""):
128
  init_image = dict['image'].convert('RGB').resize((imgRes, imgRes))
129
  filename = f"{uuid.uuid4()}.png"
130
  plt.imsave(filename,torch.sigmoid(preds[0][0]))
131
- ret,img2 = cv2.imread(filename)
132
- if ret == True:
133
  gray_image = cv2.cvtColor(img2, cv2.COLOR_BGR2GRAY)
134
  (thresh, bw_image) = cv2.threshold(gray_image, 100, 255, cv2.THRESH_BINARY)
135
  cv2.cvtColor(bw_image, cv2.COLOR_BGR2RGB)
@@ -158,9 +158,9 @@ def predict(radio, dict, word_mask, prompt=""):
158
  init_image = dict['image'].convert('RGB').resize((imgRes, imgRes))
159
  filename = f"{uuid.uuid4()}.png"
160
  plt.imsave(filename,torch.sigmoid(preds[0][0]))
161
- ret,img2 = cv2.imread(filename)
162
 
163
- if ret == True:
164
  gray_image = cv2.cvtColor(img2, cv2.COLOR_BGR2GRAY)
165
  (thresh, bw_image) = cv2.threshold(gray_image, 100, 255, cv2.THRESH_BINARY)
166
  cv2.cvtColor(bw_image, cv2.COLOR_BGR2RGB)
 
128
  init_image = dict['image'].convert('RGB').resize((imgRes, imgRes))
129
  filename = f"{uuid.uuid4()}.png"
130
  plt.imsave(filename,torch.sigmoid(preds[0][0]))
131
+ img2 = cv2.imread(filename)
132
+ #if ret == True:
133
  gray_image = cv2.cvtColor(img2, cv2.COLOR_BGR2GRAY)
134
  (thresh, bw_image) = cv2.threshold(gray_image, 100, 255, cv2.THRESH_BINARY)
135
  cv2.cvtColor(bw_image, cv2.COLOR_BGR2RGB)
 
158
  init_image = dict['image'].convert('RGB').resize((imgRes, imgRes))
159
  filename = f"{uuid.uuid4()}.png"
160
  plt.imsave(filename,torch.sigmoid(preds[0][0]))
161
+ img2 = cv2.imread(filename)
162
 
163
+ #if ret == True:
164
  gray_image = cv2.cvtColor(img2, cv2.COLOR_BGR2GRAY)
165
  (thresh, bw_image) = cv2.threshold(gray_image, 100, 255, cv2.THRESH_BINARY)
166
  cv2.cvtColor(bw_image, cv2.COLOR_BGR2RGB)