Burman-AI commited on
Commit
32ae7d0
·
verified ·
1 Parent(s): 30d0297

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -62
app.py DELETED
@@ -1,62 +0,0 @@
1
- import gradio as gr
2
- import spaces
3
- from PIL import Image
4
- # Import necessary functions from main_code_script
5
- from main_code_script import start_tryon # Adjust import as needed
6
- import os
7
-
8
- example_path = os.path.join(os.path.dirname(__file__), 'example') # [cite: 61]
9
- garm_list = os.listdir(os.path.join(example_path, "cloth")) # [cite: 83]
10
- garm_list_path = [os.path.join(example_path, "cloth", garm) for garm in garm_list] # [cite: 83]
11
- human_list = os.listdir(os.path.join(example_path, "human")) # [cite: 83]
12
- human_list_path = [os.path.join(example_path, "human", human) for human in human_list] # [cite: 83]
13
- human_ex_list =''
14
- for ex_human in human_list_path:
15
- ex_dict = {}
16
- ex_dict['background'] = ex_human
17
- ex_dict['layers'] = None
18
- ex_dict['composite'] = None
19
- human_ex_list.append(ex_dict) # [cite: 83]
20
- ##default human
21
- image_blocks = gr.Blocks(theme="Nymbo/Alyx_Theme").queue() # [cite: 83, 84]
22
- with image_blocks as demo:
23
- gr.HTML("<center><h1>Virtual Try-On</h1></center>") # [cite: 84]
24
- gr.HTML("<center><p>Upload an image of a person and an image of a garment ✨ </p></center>") # [cite: 84]
25
- with gr.Row():
26
- with gr.Column():
27
- imgs = gr.ImageEditor(sources='upload', type="pil", label='Human. Mask with pen or use auto-masking', interactive=True) # [cite: 84, 85]
28
- with gr.Row():
29
- is_checked = gr.Checkbox(label="Yes", info="Use auto-generated mask (Takes 5 seconds)", value=True) # [cite: 85]
30
- with gr.Row():
31
- is_checked_crop = gr.Checkbox(label="Yes", info="Use auto-crop & resizing", value=False) # [cite: 85]
32
- example = gr.Examples(
33
- inputs=imgs,
34
- examples_per_page=10,
35
- examples=human_ex_list
36
- ) # [cite: 85, 86]
37
- with gr.Column():
38
- garm_img = gr.Image(label="Garment", sources='upload', type="pil") # [cite: 86, 87]
39
- with gr.Row(elem_id="prompt-container"):
40
- with gr.Row():
41
- prompt = gr.Textbox(placeholder="Description of garment ex) Short Sleeve Round Neck T-shirts", show_label=False, elem_id="prompt")
42
- example = gr.Examples(
43
- inputs=garm_img,
44
- examples_per_page=8,
45
- examples=garm_list_path) # [cite: 87, 88]
46
- with gr.Column():
47
- # image_out = gr.Image(label="Output", elem_id="output-img", height=400)
48
- masked_img = gr.Image(label="Masked image output", elem_id="masked-img", show_share_button=False) # [cite: 88]
49
- with gr.Column():
50
- # image_out = gr.Image(label="Output", elem_id="output-img", height=400)
51
- image_out = gr.Image(label="Output", elem_id="output-img", show_share_button=False) # [cite: 88, 89]
52
- with gr.Column():
53
- try_button = gr.Button(value="Try-on") # [cite: 89]
54
- with gr.Accordion(label="Advanced Settings", open=False):
55
- with gr.Row():
56
- denoise_steps = gr.Number(label="Denoising Steps", minimum=20, maximum=40, value=30, step=1) # [cite: 89]
57
- seed = gr.Number(label="Seed", minimum=-1, maximum=2147483647, step=1, value=42) # [cite: 89]
58
- try_button.click(fn=start_tryon, inputs=[imgs, garm_img, prompt, is_checked, is_checked_crop, denoise_steps, seed],
59
- outputs=[image_out, masked_img], api_name='tryon') # [cite: 89]
60
-
61
- if __name__ == "__main__":
62
- image_blocks.launch()