Spaces:
Runtime error
Runtime error
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
from PIL import Image
|
|
|
3 |
|
4 |
demo_inf_ofa = gr.Interface.load(name="spaces/ICML2022/OFA") #"spaces/freddyaboulton/blocks_inputs")
|
5 |
#demo_inf_lama = gr.Interface.load(name="spaces/CVPR/lama-example") #gr.Blocks.load
|
@@ -8,9 +9,12 @@ demo_inf_ofa = gr.Interface.load(name="spaces/ICML2022/OFA") #"spaces/freddyabou
|
|
8 |
#assert demo_inf("Foo", "bar") == "Foo bar"
|
9 |
|
10 |
def get_lama(img1, img2):
|
11 |
-
Img1 = Image.open(img1)
|
12 |
-
Img2 = Image.open(img2)
|
13 |
-
|
|
|
|
|
|
|
14 |
return img
|
15 |
|
16 |
#def txt_fun(txt1, txt2):
|
@@ -61,4 +65,4 @@ with demo:
|
|
61 |
#b2.click(txt_fun, inputs=[in_text1, in_text2], outputs=out_text)
|
62 |
#examples=examples
|
63 |
|
64 |
-
demo.launch(enable_queue=True, debug=True)
|
|
|
1 |
import gradio as gr
|
2 |
from PIL import Image
|
3 |
+
import cv2
|
4 |
|
5 |
demo_inf_ofa = gr.Interface.load(name="spaces/ICML2022/OFA") #"spaces/freddyaboulton/blocks_inputs")
|
6 |
#demo_inf_lama = gr.Interface.load(name="spaces/CVPR/lama-example") #gr.Blocks.load
|
|
|
9 |
#assert demo_inf("Foo", "bar") == "Foo bar"
|
10 |
|
11 |
def get_lama(img1, img2):
|
12 |
+
Img1 = cv2.imread(img1) #Image.open(img1)
|
13 |
+
Img2 = cv2.imread(img2) #Image.open(img2)
|
14 |
+
img1_pil = Image.fromarray(Img1)
|
15 |
+
img2_pil = Image.fromarray(Img2)
|
16 |
+
img, mask = gr.Interface.load(name="spaces/CVPR/lama-example")(img1_pil, img2_pil, "automatic (U2net)")
|
17 |
+
#TypeError: expected str, bytes or os.PathLike object, not JpegImageFile
|
18 |
return img
|
19 |
|
20 |
#def txt_fun(txt1, txt2):
|
|
|
65 |
#b2.click(txt_fun, inputs=[in_text1, in_text2], outputs=out_text)
|
66 |
#examples=examples
|
67 |
|
68 |
+
demo.launch(enable_queue=True, debug=True)
|