Thiwanka01's picture
Create app.py
8f4fe98 verified
import gradio as gr
from PIL import Image
import random
# Mock function to generate a design (replace with your AI model)
def generate_design(mood_board, style_preference, complexity, color_tone):
# Here you would use your AI model to generate the design.
# This is just a placeholder for demonstration purposes.
design_text = f"Generated a {style_preference} design with {color_tone} tones at complexity level {complexity}."
design_image = Image.new("RGB", (512, 512), color=(random.randint(0, 255), random.randint(0, 255), random.randint(0, 255)))
return design_image, design_text
# Create the Gradio interface
mood_board_input = gr.Image(type="pil", label="Upload Mood Board (optional)")
style_preference_input = gr.Dropdown(
choices=["Casual", "Formal", "Sporty", "Bohemian", "Avant-garde"],
label="Style Preference"
)
complexity_input = gr.Slider(1, 10, step=1, label="Complexity Level")
color_tone_input = gr.Radio(
choices=["Bright", "Muted", "Neutral", "Pastel"],
label="Color Tone"
)
outputs = [
gr.Image(label="Generated Fashion Design"),
gr.Textbox(label="Design Details")
]
interface = gr.Interface(
fn=generate_design,
inputs=[mood_board_input, style_preference_input, complexity_input, color_tone_input],
outputs=outputs,
title="AI-Assisted Designer Tool",
description="Generate unique fashion designs based on mood boards, style preferences, and other inputs."
)
# Launch the interface
interface.launch()