sidharthism commited on
Commit
f0ecd39
1 Parent(s): 200037e

cloth segmentation done

Browse files
Files changed (6) hide show
  1. .gitignore +3 -0
  2. app.py +24 -3
  3. cloth/cloth.jpg +0 -0
  4. cloth_mask/cloth.jpg +0 -0
  5. cloth_segmentation +1 -0
  6. requirements.txt +0 -0
.gitignore ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ tryon/
2
+ requirements_local.txt
3
+ __pycache__/
app.py CHANGED
@@ -1,4 +1,25 @@
1
  import os
2
- print(os.getcwd())
3
- print(os.path.abspath(__file__))
4
- print(os.path.dirname(__file__))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import os
2
+ from PIL import Image
3
+ import gradio as gr
4
+ from cloth_segmentation import generate_cloth_mask
5
+
6
+
7
+ def generate_cloth_mask_and_display(cloth_img):
8
+ path = 'cloth/cloth.jpg'
9
+ if os.path.exists(path):
10
+ os.remove(path)
11
+ cloth_img.save(path)
12
+ try:
13
+ # os.system('.\cloth_segmentation\generate_cloth_mask.py')
14
+ generate_cloth_mask()
15
+ except Exception as e:
16
+ print(e)
17
+ return
18
+ cloth_mask_img = Image.open("cloth_mask/cloth.jpg")
19
+ return cloth_mask_img
20
+
21
+
22
+ gr.Interface(fn=generate_cloth_mask_and_display,
23
+ inputs=gr.Image(type="pil"),
24
+ outputs="image"
25
+ ).launch(debug=True)
cloth/cloth.jpg ADDED
cloth_mask/cloth.jpg ADDED
cloth_segmentation ADDED
@@ -0,0 +1 @@
 
 
1
+ Subproject commit 28392f0da3aa5eb9ae64db73d04b31be10ce6350
requirements.txt ADDED
Binary file (2.33 kB). View file