eTouchCode commited on
Commit
aa95714
·
1 Parent(s): a0af339

restore the code

Browse files
Files changed (1) hide show
  1. app.py +7 -61
app.py CHANGED
@@ -1,72 +1,18 @@
1
  import subprocess
2
  import sys
3
 
 
 
 
 
 
4
  # Install gradio manually
5
- print(">>>Start of the building")
6
  subprocess.check_call([sys.executable, "-m", "pip", "install", "gradio"])
7
- print(">>>Step started!")
8
  import gradio as gr
9
 
10
  def greet(name):
11
  return "Hello " + name + "!!"
12
 
13
- def start_tryon():
14
- return "Hello " + "**" + "!!"
15
-
16
- # iface = gr.Interface(fn=greet, inputs="text", outputs="text")
17
- # iface.launch()
18
-
19
-
20
- human_ex_list = []
21
- for ex_human in human_ex_list:
22
- ex_dict = {}
23
- ex_dict['background'] = ex_human
24
- ex_dict['layers'] = None
25
- ex_dict['composite'] = None
26
- human_ex_list.append(ex_dict)
27
-
28
- ## default human
29
-
30
- image_blocks = gr.Blocks().queue()
31
-
32
- with image_blocks as demo:
33
- gr.Markdown("## Virtual Try On")
34
- gr.Markdown("Virtual Try -n with your image and garment image.")
35
- with gr.Row():
36
- with gr.Column():
37
- imgs = gr.ImageEditor(sources='upload', type='pil', label='Human, Mask with pen or use auto-masking', interactive=True)
38
- with gr.Row():
39
- is_checked = gr.Checkbox(label="Yes", info="Use auto-generated mask (Takes 5 seconds)", value=True)
40
- with gr.Row():
41
- is_checked_crop = gr.Checkbox(label="Yes", info="Use auto-crop & resizing", value=False)
42
- ### EXAMPLE TODO
43
- example = gr.Examples(
44
- inputs=imgs,
45
- example_per_page=10,
46
- examples=human_ex_list
47
- )
48
-
49
- with gr.Column():
50
- garm_img = gr.Image(label="Garment", sources='upload', type='pil')
51
- with gr.Row(elem_id="promt-container"):
52
- prompt = gr.Textbox(placeholder="Description of garment ex) Short Sleeve Round Neck T-shirts", show_label=False, elem_id="prompt")
53
- ### EXAPLE TODO
54
-
55
- with gr.Column():
56
- masked_img = gr.Image(label="Masked iamge output", elem_id="masked-img", show_share_button=False)
57
- with gr.Column():
58
- image_out = gr.Image(label="Output", elem_id="output-img", show_share_button=False)
59
-
60
- with gr.Column():
61
- try_button = gr.Button(value="Try-on")
62
- with gr.Accordion(label = "Advanced Settings", open=False):
63
- with gr.Row():
64
- denoise_steps = gr.Number(label="Denoising Steps", minimum=20, maximum=40, value=30, step=1)
65
- seed = gr.Number(label="Seed", minimum=-1, maximum=2147483647, step=1, value=42)
66
-
67
- try_button.click(fn=start_tryon, inputs=[imgs, garm_img, prompt, is_checked, is_checked_crop, denoise_steps, seed], outputs=[image_out, masked_img], api_name='tryon')
68
-
69
 
70
- print("why")
71
- print("s")
72
- print("wtf")
 
1
  import subprocess
2
  import sys
3
 
4
+ from transformers import AutoTokenizer
5
+ import numpy as np
6
+ from torchvision import transforms
7
+
8
+
9
  # Install gradio manually
 
10
  subprocess.check_call([sys.executable, "-m", "pip", "install", "gradio"])
 
11
  import gradio as gr
12
 
13
  def greet(name):
14
  return "Hello " + name + "!!"
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
+ iface = gr.Interface(fn=greet, inputs="text", outputs="text")
18
+ iface.launch()