to-be commited on
Commit
196a89d
1 Parent(s): bec15b6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -8,6 +8,8 @@ import shutil
8
  import gradio as gr
9
  from PIL import Image
10
  from runpy import run_path
 
 
11
 
12
  examples = [['sample1.png'],
13
  ['sample2.png']]
@@ -58,8 +60,9 @@ def inference(img, task, run_on):
58
  if torch.cuda.is_available():
59
  torch.cuda.ipc_collect()
60
  torch.cuda.empty_cache()
61
-
62
- img = cv2.cvtColor(cv2.imread(args.input_path), cv2.COLOR_BGR2RGB)
 
63
 
64
  input_ = torch.from_numpy(img).float().div(255.).permute(2,0,1).unsqueeze(0).to(device)
65
 
 
8
  import gradio as gr
9
  from PIL import Image
10
  from runpy import run_path
11
+ import numpy as np
12
+
13
 
14
  examples = [['sample1.png'],
15
  ['sample2.png']]
 
60
  if torch.cuda.is_available():
61
  torch.cuda.ipc_collect()
62
  torch.cuda.empty_cache()
63
+
64
+ open_cv_image = np.array(img)
65
+ img = cv2.cvtColor(cv2.imread(open_cv_image), cv2.COLOR_BGR2RGB)
66
 
67
  input_ = torch.from_numpy(img).float().div(255.).permute(2,0,1).unsqueeze(0).to(device)
68