File size: 2,148 Bytes
238cf85
 
 
c57984b
 
 
 
 
238cf85
 
c57984b
 
 
238cf85
 
 
 
 
 
 
 
 
 
 
 
 
c57984b
238cf85
 
 
 
c57984b
 
 
 
238cf85
 
 
c57984b
238cf85
c57984b
238cf85
c57984b
238cf85
c57984b
 
 
 
238cf85
 
c57984b
 
 
 
238cf85
 
c57984b
 
 
 
 
238cf85
 
c57984b
 
238cf85
 
 
c57984b
 
 
238cf85
 
c57984b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import gradio as gr
import random

# Example T-shirt mockup generation function (replace with actual implementation)
def generate_tshirt_mockup(style, color, graphics, text=None):
    # Generate a mockup based on T-shirt style, color, graphics, and optionally text
    mockup = f"Generated T-shirt mockup:\nStyle: {style}\nColor: {color}\nGraphics: {graphics}\nText: {text}" if text else f"Generated T-shirt mockup:\nStyle: {style}\nColor: {color}\nGraphics: {graphics}"
    return mockup

examples = [
    "Casual T-shirt, Blue, with abstract art",
    "Formal T-shirt, White, with logo",
    "Sports T-shirt, Red, with team name",
]

css="""
#col-container {
    margin: 0 auto;
    max-width: 520px;
}
"""

with gr.Blocks(css=css) as demo:
    
    with gr.Column(elem_id="col-container"):
        gr.Markdown(f"""
        # T-shirt Mockup Generator
        """)
        
        with gr.Row():
            
            style = gr.Dropdown(
                label="T-shirt Style",
                choices=["Casual", "Formal", "Sports"],
                default="Casual",
                container=False,
            )
            
            run_button = gr.Button("Generate Mockup", scale=0)
        
        result = gr.Textbox(label="Mockup", placeholder="Generated Mockup", readonly=True)

        with gr.Accordion("Design Options", open=False):
            
            color = gr.Textbox(
                label="T-shirt Color",
                placeholder="Enter color",
                visible=True,
            )
            
            graphics = gr.Textbox(
                label="Graphics",
                placeholder="Enter graphic details",
                visible=True,
            )
            
            text = gr.Textbox(
                label="Text (optional)",
                placeholder="Enter text for T-shirt",
                visible=True,
            )
            
        gr.Examples(
            examples=examples,
            inputs=[style]
        )

    run_button.click(
        fn=generate_tshirt_mockup,
        inputs=[style, color, graphics, text],
        outputs=[result]
    )

demo.queue().launch()