Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import modal
|
2 |
import gradio as gr
|
3 |
-
|
4 |
|
5 |
f = modal.Cls.lookup("casa-interior-hf-v2", "DesignModel")
|
6 |
|
@@ -17,7 +17,13 @@ def casa_ai_run_tab2(dict=None, text=None):
|
|
17 |
|
18 |
image = dict["background"].convert("RGB")
|
19 |
mask = dict["layers"][0].convert('L')
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
if image is None and text is None:
|
22 |
print('Please provide context in form of image, text')
|
23 |
return None
|
|
|
1 |
import modal
|
2 |
import gradio as gr
|
3 |
+
import numpy as np
|
4 |
|
5 |
f = modal.Cls.lookup("casa-interior-hf-v2", "DesignModel")
|
6 |
|
|
|
17 |
|
18 |
image = dict["background"].convert("RGB")
|
19 |
mask = dict["layers"][0].convert('L')
|
20 |
+
|
21 |
+
if np.sum(np.array(mask)) == 0:
|
22 |
+
mask = None
|
23 |
+
|
24 |
+
if mask is None:
|
25 |
+
print('Please provide a mask over the object you want to generate again.')
|
26 |
+
|
27 |
if image is None and text is None:
|
28 |
print('Please provide context in form of image, text')
|
29 |
return None
|