Update app.py
Browse files
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 |
-
|
|
|
|
| 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 |
|