michaelapplydesign commited on
Commit
31e41b7
·
1 Parent(s): 920ece4
.idea/.gitignore DELETED
@@ -1,8 +0,0 @@
1
- # Default ignored files
2
- /shelf/
3
- /workspace.xml
4
- # Editor-based HTTP Client requests
5
- /httpRequests/
6
- # Datasource local storage ignored files
7
- /dataSources/
8
- /dataSources.local.xml
 
 
 
 
 
 
 
 
 
.idea/RemoveFurnitureV1.iml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="PYTHON_MODULE" version="4">
3
- <component name="NewModuleRootManager">
4
- <content url="file://$MODULE_DIR$" />
5
- <orderEntry type="inheritedJdk" />
6
- <orderEntry type="sourceFolder" forTests="false" />
7
- </component>
8
- </module>
 
 
 
 
 
 
 
 
 
.idea/inspectionProfiles/Project_Default.xml DELETED
@@ -1,15 +0,0 @@
1
- <component name="InspectionProjectProfileManager">
2
- <profile version="1.0">
3
- <option name="myName" value="Project Default" />
4
- <inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
5
- <option name="ignoredPackages">
6
- <value>
7
- <list size="2">
8
- <item index="0" class="java.lang.String" itemvalue="opencv_python" />
9
- <item index="1" class="java.lang.String" itemvalue="skimage" />
10
- </list>
11
- </value>
12
- </option>
13
- </inspection_tool>
14
- </profile>
15
- </component>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.idea/inspectionProfiles/profiles_settings.xml DELETED
@@ -1,6 +0,0 @@
1
- <component name="InspectionProjectProfileManager">
2
- <settings>
3
- <option name="USE_PROJECT_PROFILE" value="false" />
4
- <version value="1.0" />
5
- </settings>
6
- </component>
 
 
 
 
 
 
 
.idea/misc.xml DELETED
@@ -1,7 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="Black">
4
- <option name="sdkName" value="Python 3.12" />
5
- </component>
6
- <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.12" project-jdk-type="Python SDK" />
7
- </project>
 
 
 
 
 
 
 
 
.idea/modules.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/RemoveFurnitureV1.iml" filepath="$PROJECT_DIR$/.idea/RemoveFurnitureV1.iml" />
6
- </modules>
7
- </component>
8
- </project>
 
 
 
 
 
 
 
 
 
.idea/vcs.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="" vcs="Git" />
5
- </component>
6
- </project>
 
 
 
 
 
 
 
app.py CHANGED
@@ -4,19 +4,10 @@ from PIL import Image
4
  import numpy as np
5
 
6
  # from config import setResoluton
7
- from models import make_image_controlnet, make_inpainting
8
  from preprocessing import get_mask
9
 
10
- def image_to_byte_array(image: Image) -> bytes:
11
- # BytesIO is a fake file stored in memory
12
- imgByteArr = io.BytesIO()
13
- # image.save expects a file as a argument, passing a bytes io ins
14
- image.save(imgByteArr, format='png') # image.format
15
- # Turn the BytesIO object back into a bytes object
16
- imgByteArr = imgByteArr.getvalue()
17
- return imgByteArr
18
-
19
- def predict(input_img1,
20
  input_img2,
21
  positive_prompt,
22
  negative_prompt,
@@ -24,18 +15,9 @@ def predict(input_img1,
24
  resolution
25
  ):
26
 
27
-
28
-
29
  print("predict")
30
- # bla bla
31
- # input_img1 = Image.fromarray(input_img1)
32
- # input_img2 = Image.fromarray(input_img2)
33
-
34
- # setResoluton(resolution)
35
  HEIGHT = resolution
36
  WIDTH = resolution
37
- # WIDTH = resolution
38
- # HEIGHT = resolution
39
 
40
  input_img1 = input_img1.resize((resolution, resolution))
41
  input_img2 = input_img2.resize((resolution, resolution))
@@ -58,41 +40,36 @@ def predict(input_img1,
58
 
59
  return retList
60
 
61
-
62
- app = gr.Interface(
63
- predict,
64
- inputs=[gr.Image(label="img", sources=['upload'], type="pil"),
65
- gr.Image(label="mask", sources=['upload'], type="pil"),
66
- gr.Textbox(label="positive_prompt",value="empty room"),
67
- gr.Textbox(label="negative_prompt",value=""),
68
- gr.Number(label="num_of_images",value=2),
69
- gr.Number(label="resolution",value=512)
70
- ],
71
- outputs= [
72
- gr.Image(label="resp0"),
73
- gr.Image(label="resp1"),
74
- gr.Image(label="resp2"),
75
- gr.Image(label="resp3"),
76
- gr.Image(label="resp4"),
77
- gr.Image(label="resp5"),
78
- gr.Image(label="resp6"),
79
- gr.Image(label="resp7"),
80
- gr.Image(label="resp8"),
81
- gr.Image(label="resp9")],
82
- title="rem fur 1",
83
- )
84
-
85
- app.launch(share=True)
86
-
87
- #
88
-
89
-
90
- # gr.Interface(
91
- # test1,
92
- # inputs=[gr.Textbox(label="param1")],
93
- # outputs= gr.Textbox(label="result"),
94
- # title="rem fur 1",
95
- # ).launch(share=True)
96
-
97
-
98
-
 
4
  import numpy as np
5
 
6
  # from config import setResoluton
7
+ from models import make_inpainting
8
  from preprocessing import get_mask
9
 
10
+ def rf(input_img1,
 
 
 
 
 
 
 
 
 
11
  input_img2,
12
  positive_prompt,
13
  negative_prompt,
 
15
  resolution
16
  ):
17
 
 
 
18
  print("predict")
 
 
 
 
 
19
  HEIGHT = resolution
20
  WIDTH = resolution
 
 
21
 
22
  input_img1 = input_img1.resize((resolution, resolution))
23
  input_img2 = input_img2.resize((resolution, resolution))
 
40
 
41
  return retList
42
 
43
+ def segmentation(image):
44
+ return image
45
+
46
+ def upscale(image):
47
+ return image
48
+
49
+ with gr.Blocks() as app:
50
+
51
+ gr.Button("FurnituRemove").click(rf,
52
+ inputs=[gr.Image(label="img", type="pil"),
53
+ gr.Image(label="mask", type="pil"),
54
+ gr.Textbox(label="positive_prompt",value="empty room"),
55
+ gr.Textbox(label="negative_prompt",value=""),
56
+ gr.Number(label="num_of_images",value=2),
57
+ gr.Number(label="resolution",value=512)
58
+ ],
59
+ outputs=[
60
+ gr.Image(),
61
+ gr.Image(),
62
+ gr.Image(),
63
+ gr.Image(),
64
+ gr.Image(),
65
+ gr.Image(),
66
+ gr.Image(),
67
+ gr.Image(),
68
+ gr.Image(),
69
+ gr.Image()])
70
+
71
+ gr.Button("Segmentation").click(segmentation, inputs=gr.Image(type="pil"), outputs=gr.Image())
72
+
73
+ gr.Button("Upscale").click(upscale, inputs=gr.Image(type="pil"), outputs=gr.Image())
74
+
75
+ app.launch(debug=True)
 
 
 
 
 
utils.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ def image_to_byte_array(image: Image) -> bytes:
2
+ # BytesIO is a fake file stored in memory
3
+ imgByteArr = io.BytesIO()
4
+ # image.save expects a file as a argument, passing a bytes io ins
5
+ image.save(imgByteArr, format='png') # image.format
6
+ # Turn the BytesIO object back into a bytes object
7
+ imgByteArr = imgByteArr.getvalue()
8
+ return imgByteArr