Spaces:
Configuration error
Configuration error
| import gradio as gr | |
| from diffusers import StableDiffusionPipeline | |
| import torch | |
| # Modello Hugging Face per tatuaggi | |
| MODEL_ID = "lllyasviel/control_v11p_sd15_lineart" | |
| # Caricamento modello | |
| pipe = StableDiffusionPipeline.from_pretrained( | |
| MODEL_ID, | |
| torch_dtype=torch.float16 | |
| ) | |
| # Se hai GPU, puoi usare: pipe.to("cuda") | |
| pipe.to("cpu") | |
| # Funzione per generare tatuaggi | |
| def generate_tattoo(prompt): | |
| final_prompt = f"{prompt}, clean lineart, tattoo style, black ink, detailed, high contrast" | |
| image = pipe(final_prompt).images[0] | |
| return image | |
| # Interfaccia Gradio | |
| interface = gr.Interface( | |
| fn=generate_tattoo, | |
| inputs=gr.Textbox(label="Write your tattoo idea"), | |
| outputs="image", | |
| title="AI Tattoo Generator", | |
| description="Generate custom tattoo designs using AI. Write your idea and get a unique tattoo." | |
| ) | |
| # Avvio app | |
| interface.launch() | |