Spaces:
Sleeping
Sleeping
Commit
·
ff7142e
1
Parent(s):
13cb3ce
up v5
Browse files
app.py
CHANGED
|
@@ -1,25 +1,23 @@
|
|
| 1 |
-
# import gradio as gr
|
| 2 |
-
#
|
| 3 |
-
# def greet(name):
|
| 4 |
-
# return "V5 Hello " + name + "!!"
|
| 5 |
-
#
|
| 6 |
-
# iface = gr.Interface(
|
| 7 |
-
# fn=greet,
|
| 8 |
-
# inputs="text",
|
| 9 |
-
# outputs="text",
|
| 10 |
-
# title="MB TEST 1",
|
| 11 |
-
# )
|
| 12 |
-
# iface.launch(share=True)
|
| 13 |
-
|
| 14 |
import gradio as gr
|
| 15 |
from models import make_inpainting
|
| 16 |
import io
|
| 17 |
from PIL import Image
|
| 18 |
import numpy as np
|
| 19 |
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
def image_to_byte_array(image: Image) -> bytes:
|
| 25 |
# BytesIO is a fake file stored in memory
|
|
@@ -43,7 +41,7 @@ def predict(input_img1,input_img2):
|
|
| 43 |
|
| 44 |
|
| 45 |
# predictions = pipeline(input_img1)
|
| 46 |
-
return
|
| 47 |
|
| 48 |
gradio_app = gr.Interface(
|
| 49 |
predict,
|
|
@@ -54,6 +52,5 @@ gradio_app = gr.Interface(
|
|
| 54 |
title="rem fur 1",
|
| 55 |
)
|
| 56 |
|
| 57 |
-
|
| 58 |
gradio_app.launch(share=True)
|
| 59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from models import make_inpainting
|
| 3 |
import io
|
| 4 |
from PIL import Image
|
| 5 |
import numpy as np
|
| 6 |
|
| 7 |
+
from PIL import Image
|
| 8 |
+
from typing import Union
|
| 9 |
+
import random
|
| 10 |
+
import numpy as np
|
| 11 |
+
import os
|
| 12 |
+
import time
|
| 13 |
+
|
| 14 |
+
from models import make_image_controlnet, make_inpainting
|
| 15 |
+
from segmentation import segment_image
|
| 16 |
+
from config import HEIGHT, WIDTH, POS_PROMPT, NEG_PROMPT, COLOR_MAPPING, map_colors, map_colors_rgb
|
| 17 |
+
from palette import COLOR_MAPPING_CATEGORY
|
| 18 |
+
from preprocessing import preprocess_seg_mask, get_image, get_mask
|
| 19 |
+
from explanation import make_inpainting_explanation, make_regeneration_explanation, make_segmentation_explanation
|
| 20 |
+
|
| 21 |
|
| 22 |
def image_to_byte_array(image: Image) -> bytes:
|
| 23 |
# BytesIO is a fake file stored in memory
|
|
|
|
| 41 |
|
| 42 |
|
| 43 |
# predictions = pipeline(input_img1)
|
| 44 |
+
return result_image
|
| 45 |
|
| 46 |
gradio_app = gr.Interface(
|
| 47 |
predict,
|
|
|
|
| 52 |
title="rem fur 1",
|
| 53 |
)
|
| 54 |
|
|
|
|
| 55 |
gradio_app.launch(share=True)
|
| 56 |
|