Josue Aaron Soriano Rivero commited on
Commit
f83a4da
·
1 Parent(s): a673012

feat: agregar nueva pestaña con ejemplos e imágenes y añadir README

Browse files
Files changed (44) hide show
  1. README.md +66 -0
  2. app.py +27 -10
  3. assets/eyes_styles/crazy_eyes.webp +0 -0
  4. assets/eyes_styles/empty_eyes.webp +0 -0
  5. assets/eyes_styles/heart-shaped_eyes.webp +0 -0
  6. assets/eyes_styles/jitome_eyes.webp +0 -0
  7. assets/eyes_styles/sanpaku_eyes.webp +0 -0
  8. assets/eyes_styles/solid_circle_eyes.webp +0 -0
  9. assets/eyes_styles/sparkling_eyes.webp +0 -0
  10. assets/eyes_styles/tareme_eyes.webp +0 -0
  11. assets/eyes_styles/tsurime_eyes.webp +0 -0
  12. assets/hats/bicorne.webp +0 -0
  13. assets/hats/gat_hat.webp +0 -0
  14. assets/hats/jingasa.webp +0 -0
  15. assets/hats/mob_cap.webp +0 -0
  16. assets/hats/peaked_cap.webp +0 -0
  17. assets/hats/shako_cap.webp +0 -0
  18. assets/helmets/adrian_helmet.webp +0 -0
  19. assets/helmets/altyn_helmet.webp +0 -0
  20. assets/helmets/brodie_helmet.webp +0 -0
  21. assets/helmets/fishbowl_helmet.webp +0 -0
  22. assets/helmets/sallet.webp +0 -0
  23. assets/helmets/stahlhelm.webp +0 -0
  24. assets/img_docs/bob_cut.webp +0 -0
  25. assets/img_docs/bowl_cut.webp +0 -0
  26. assets/img_docs/cornrows.webp +0 -0
  27. assets/img_docs/crew_cut.webp +0 -0
  28. assets/img_docs/dreadlocks.webp +0 -0
  29. assets/img_docs/flipped_hair.webp +0 -0
  30. assets/img_docs/hime_cut.webp +0 -0
  31. assets/img_docs/pixie_cut.webp +0 -0
  32. assets/img_docs/undercut.webp +0 -0
  33. assets/img_docs/wolf_cut.webp +0 -0
  34. assets/texture/curly_hair.webp +0 -0
  35. assets/texture/drill_hair.webp +0 -0
  36. assets/texture/hair_flaps.webp +0 -0
  37. assets/texture/messy_hair.webp +0 -0
  38. assets/texture/pointy_hair.webp +0 -0
  39. assets/texture/ringlets.webp +0 -0
  40. assets/texture/spiked_hair.webp +0 -0
  41. assets/texture/straight_hair.webp +0 -0
  42. assets/texture/wavy_hair.webp +0 -0
  43. data_image_guide.py +57 -0
  44. image_guide.py +33 -0
README.md ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Retrato WaifuStudio
2
+ **Genera fotos de perfil estilo anime totalmente personalizables** sin necesidad de utilizar prompts complejos. Simplemente selecciona las características deseadas (cabello, ojos, boca, expresiones, accesorios) y obtén un retrato único.
3
+
4
+
5
+ Retrato WaifuStudio utiliza **Waifu Diffusion v1.3**, un modelo entrenado por **Hakurei** y alojado en HuggingFace.
6
+
7
+ ---
8
+
9
+ ## 🚀 Características
10
+ - **Interfaz intuitiva:** Elige características fácilmente en lugar de escribir prompts complejos.
11
+ - **Personalización total:** Crea retratos únicos ajustando detalles como expresiones, accesorios y más.
12
+ - **Basado en IA:** Potenciado por el modelo **Waifu Diffusion v1.3** para obtener resultados increíbles.
13
+
14
+ ---
15
+
16
+ ## 🌐 Ejecución en HuggingFace Spaces (fácil)
17
+
18
+ Retrato WaifuStudio está desplegado en un espacio de HuggingFace. Sin embargo, actualmente utiliza los recursos de la capa gratuita, lo que puede tener **tiempos de carga extremadamente largos**.
19
+
20
+ [![Abrir en Spaces](https://huggingface.co/datasets/huggingface/badges/resolve/main/open-in-hf-spaces-md-dark.svg)]()
21
+
22
+ ### Ayuda a mejorar
23
+ Tu apoyo puede hacer que este proyecto crezca 🚀. Las donaciones permitirán:
24
+ - **Imágenes de mayor calidad.**
25
+ - **Acceso sin limitaciones:** Genera contenido creativo o explícito bajo demanda.
26
+ - **Disponibilidad 24/7:** Ejecuta el modelo sin interrupciones desde HuggingFace Spaces.
27
+
28
+ [![Donar](https://img.shields.io/badge/Donar-Ayuda%20ahora-FFA500?style=for-the-badge&logo=paypal)](https://paypal.me/srjosuearon?country.x=MX&locale.x=es_XC)
29
+
30
+ ## 🚀 Ejecución en Google Colab (intermedio)
31
+ Puedes ejecutar **Retrato WaifuStudio** directamente en Google Colab sin necesidad de instalar nada en tu equipo. Solo haz clic en el botón de abajo:
32
+
33
+ [![Abrir en Google Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1n4m5If8gQNmNrvamGmNj-jwObyf8IcHE?usp=sharing)
34
+
35
+ ### Ventajas:
36
+ - **Sin hardware local:** Utiliza los recursos gratuitos de Google Colab.
37
+ - **GPU opcional:** Mejora el rendimiento activando una GPU (Configuración: Entorno de ejecución > Cambiar tipo de entorno de ejecución > Acelerador de hardware: GPU T4).
38
+
39
+ ## 🖥️ Instalación loca(
40
+ Si prefieres ejecutar Retrato WaifuStudio en tu equipo, ten en cuenta los siguientes requisitos:
41
+ - **Tarjeta gráfica potente.**
42
+ - **Memoria RAM suficiente.**
43
+
44
+ ### Pasos para instalar:
45
+ 1. Clona este repositorio.
46
+ 2. Instala las dependencias necesarias:
47
+ ```bash
48
+ pip install -r requirements.txt
49
+ ```
50
+ 3. Ejecuta el programa en tu entorno local.
51
+ ```bash
52
+ python app.py
53
+ ```
54
+
55
+ ## 🤝 Contribuciones y soporte
56
+ Este proyecto está abierto a contribuciones. Si tienes ideas, mejoras o dudas, ¡contáctame sin miedo!
57
+ Puedes enviarme un mensaje directo en cualquiera de mis redes sociales:
58
+
59
+ [![instagram](https://img.shields.io/badge/instagram-E4405F?style=for-the-badge&logo=instagram&logoColor=white)](https://www.instagram.com/srjosueaaron/)
60
+
61
+ [![Tiktok](https://img.shields.io/badge/tiktok-000000?style=for-the-badge&logo=tiktok&logoColor=white)](https://www.tiktok.com/@srjosueaaron)
62
+
63
+
64
+ [![YouTube](https://img.shields.io/badge/Youtube-FF0000?style=for-the-badge&logo=youtube&logoColor=white)](https://www.youtube.com/@srjosueaaron)
65
+
66
+ ¡Gracias por tu interés en Retrato WaifuStudio! 🎨✨
app.py CHANGED
@@ -2,17 +2,18 @@ import gradio as gr
2
  from model import get_device, load_model
3
  from utils import build_prompt, generate_image
4
  from translations import TRANSLATIONS
 
5
 
6
  device = get_device()
7
  pipe = load_model(device)
8
 
9
- def create_interface():
10
- with gr.Blocks(theme=gr.themes.Soft()) as demo:
11
  gr.Markdown("""
12
  <div style="text-align: center; margin-bottom: 30px;">
13
  <h1 style="font-size: 2.5em; color: #4F46E5; font-weight: bold;">🎨Retrato WaifuStudio</h1>
14
  <h3 style="color: #6B7280;">Genera fotos de perfil estilo anime totalmente personalizables</h3>
15
- <p style="font-size: 0.9em; color: #9CA3AF; margin-top: 20px;">Si disfrutas de esta herramienta y deseas apoyar su desarrollo continuo, considera realizar una donación sin restricciones para contribuir a futuras mejoras, incluyendo la posibilidad de generar contenido sin limitaciones, tanto creativo como explícito.</p>
16
  <a href="https://paypal.me/srjosuearon?country.x=MX&locale.x=es_XC" style="font-size: 1em; color: #4F46E5; text-decoration: underline;">Apoya con una donación</a>
17
  </div>
18
  """)
@@ -34,7 +35,11 @@ def create_interface():
34
 
35
  prompt_output = gr.Textbox(label="📝 Características de la imagen", interactive=True)
36
  image_output = gr.Image(label="📥 Imagen generada")
37
-
 
 
 
 
38
  def update_prompt(*args):
39
  kwargs = {key: value for key, value in zip(TRANSLATIONS.keys(), args)}
40
  return build_prompt(**kwargs)
@@ -76,13 +81,25 @@ def create_interface():
76
  </button>
77
  </div>
78
  """)
79
-
80
- gr.HTML("""
81
- <footer style="text-align: center; margin-top: 50px; padding: 20px; background-color: #f9fafb; border-top: 1px solid #e5e7eb; font-size: 0.9em; color: #6b7280;">
82
- <p>© 2024 WaifuCreator. Usando el modelo Waifu Diffusion de <a href="https://huggingface.co/hakurei/waifu-diffusion" style="font-size: 1em; color: #4F46E5; text-decoration: underline;">Hakurei</a></p>
83
- <p>Desarrollado con ❤️ por <a href="https://www.linkedin.com/in/srjosueaaron" style="font-size: 1em; color: #4F46E5; text-decoration: underline;">@srjosueaaron</a></p>
84
- </footer>
 
85
  """)
 
 
 
 
 
 
 
 
 
 
 
86
  return demo
87
 
88
  demo = create_interface()
 
2
  from model import get_device, load_model
3
  from utils import build_prompt, generate_image
4
  from translations import TRANSLATIONS
5
+ from image_guide import create_guide_tab
6
 
7
  device = get_device()
8
  pipe = load_model(device)
9
 
10
+ def create_main_tab():
11
+ with gr.Blocks(theme=gr.themes.Soft()) as main_tab:
12
  gr.Markdown("""
13
  <div style="text-align: center; margin-bottom: 30px;">
14
  <h1 style="font-size: 2.5em; color: #4F46E5; font-weight: bold;">🎨Retrato WaifuStudio</h1>
15
  <h3 style="color: #6B7280;">Genera fotos de perfil estilo anime totalmente personalizables</h3>
16
+ <p style="font-size: 0.9em; color: #9CA3AF; margin-top: 20px;">Si disfrutas de esta herramienta y deseas apoyar su desarrollo continuo, considera realizar una donación para contribuir a futuras mejoras, incluyendo la posibilidad de generar contenido sin limitaciones, tanto creativo como explícito.</p>
17
  <a href="https://paypal.me/srjosuearon?country.x=MX&locale.x=es_XC" style="font-size: 1em; color: #4F46E5; text-decoration: underline;">Apoya con una donación</a>
18
  </div>
19
  """)
 
35
 
36
  prompt_output = gr.Textbox(label="📝 Características de la imagen", interactive=True)
37
  image_output = gr.Image(label="📥 Imagen generada")
38
+
39
+ gr.Markdown("""
40
+ ```bash
41
+ Proximamente ejemplos completos 😎
42
+ """)
43
  def update_prompt(*args):
44
  kwargs = {key: value for key, value in zip(TRANSLATIONS.keys(), args)}
45
  return build_prompt(**kwargs)
 
81
  </button>
82
  </div>
83
  """)
84
+
85
+ gr.Markdown("""
86
+ ---
87
+
88
+ © 2024 Retrato WaifuStudio. Usando el modelo Waifu Diffusion de [Hakurei](https://huggingface.co/hakurei/waifu-diffusion).
89
+
90
+ Desarrollado con ❤️ por [@srjosueaaron](https://www.instagram.com/srjosueaaron/).
91
  """)
92
+
93
+ return main_tab
94
+
95
+ def create_interface():
96
+ with gr.Blocks(theme=gr.themes.Soft()) as demo:
97
+ with gr.Tabs():
98
+ with gr.Tab("Retrato WaifuStudio"):
99
+ create_main_tab()
100
+
101
+ with gr.Tab("Guía para generar"):
102
+ create_guide_tab()
103
  return demo
104
 
105
  demo = create_interface()
assets/eyes_styles/crazy_eyes.webp ADDED
assets/eyes_styles/empty_eyes.webp ADDED
assets/eyes_styles/heart-shaped_eyes.webp ADDED
assets/eyes_styles/jitome_eyes.webp ADDED
assets/eyes_styles/sanpaku_eyes.webp ADDED
assets/eyes_styles/solid_circle_eyes.webp ADDED
assets/eyes_styles/sparkling_eyes.webp ADDED
assets/eyes_styles/tareme_eyes.webp ADDED
assets/eyes_styles/tsurime_eyes.webp ADDED
assets/hats/bicorne.webp ADDED
assets/hats/gat_hat.webp ADDED
assets/hats/jingasa.webp ADDED
assets/hats/mob_cap.webp ADDED
assets/hats/peaked_cap.webp ADDED
assets/hats/shako_cap.webp ADDED
assets/helmets/adrian_helmet.webp ADDED
assets/helmets/altyn_helmet.webp ADDED
assets/helmets/brodie_helmet.webp ADDED
assets/helmets/fishbowl_helmet.webp ADDED
assets/helmets/sallet.webp ADDED
assets/helmets/stahlhelm.webp ADDED
assets/img_docs/bob_cut.webp ADDED
assets/img_docs/bowl_cut.webp ADDED
assets/img_docs/cornrows.webp ADDED
assets/img_docs/crew_cut.webp ADDED
assets/img_docs/dreadlocks.webp ADDED
assets/img_docs/flipped_hair.webp ADDED
assets/img_docs/hime_cut.webp ADDED
assets/img_docs/pixie_cut.webp ADDED
assets/img_docs/undercut.webp ADDED
assets/img_docs/wolf_cut.webp ADDED
assets/texture/curly_hair.webp ADDED
assets/texture/drill_hair.webp ADDED
assets/texture/hair_flaps.webp ADDED
assets/texture/messy_hair.webp ADDED
assets/texture/pointy_hair.webp ADDED
assets/texture/ringlets.webp ADDED
assets/texture/spiked_hair.webp ADDED
assets/texture/straight_hair.webp ADDED
assets/texture/wavy_hair.webp ADDED
data_image_guide.py ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+
3
+ hair = [
4
+ {"name": "Corte Lobo", "image": os.path.join("assets", "img_docs", "wolf_cut.webp")},
5
+ {"name": "Corte Bob", "image": os.path.join("assets", "img_docs", "bob_cut.webp")},
6
+ {"name": "Corte Pixie", "image": os.path.join("assets", "img_docs", "pixie_cut.webp")},
7
+ {"name": "Corte Militar", "image": os.path.join("assets", "img_docs", "crew_cut.webp")},
8
+ {"name": "Corte Tazón", "image": os.path.join("assets", "img_docs", "bowl_cut.webp")},
9
+ {"name": "Corte Bajo", "image": os.path.join("assets", "img_docs", "undercut.webp")},
10
+ {"name": "Cabello volteado", "image": os.path.join("assets", "img_docs", "flipped_hair.webp")},
11
+ {"name": "Corte Hime", "image": os.path.join("assets", "img_docs", "hime_cut.webp")},
12
+ {"name": "Trenzas", "image": os.path.join("assets", "img_docs", "cornrows.webp")},
13
+ {"name": "Rastas", "image": os.path.join("assets", "img_docs", "dreadlocks.webp")}
14
+ ]
15
+
16
+ texture = [
17
+ {"name": "Cabello liso", "image": os.path.join("assets", "texture", "straight_hair.webp")},
18
+ {"name": "Cabello ondulado", "image": os.path.join("assets", "texture", "wavy_hair.webp")},
19
+ {"name": "Cabello rizado", "image": os.path.join("assets", "texture", "curly_hair.webp")},
20
+ {"name": "Cabello despeinado", "image": os.path.join("assets", "texture", "messy_hair.webp")},
21
+ {"name": "Cabello afilado", "image": os.path.join("assets", "texture", "pointy_hair.webp")},
22
+ {"name": "Cabello rizos", "image": os.path.join("assets", "texture", "ringlets.webp")},
23
+ {"name": "Cabello perforado", "image": os.path.join("assets", "texture", "drill_hair.webp")},
24
+ {"name": "Mechones sueltos", "image": os.path.join("assets", "texture", "hair_flaps.webp")},
25
+ ]
26
+
27
+ eyes_styles = [
28
+ {"name": "Ojos brillantes", "image": os.path.join("assets", "eyes_styles", "sparkling_eyes.webp")},
29
+ {"name": "Ojos circulo sólido", "image": os.path.join("assets", "eyes_styles", "solid_circle_eyes.webp")},
30
+ {"name": "Ojos en forma de corazón", "image": os.path.join("assets", "eyes_styles", "heart-shaped_eyes.webp")},
31
+ {"name": "Ojos locos", "image": os.path.join("assets", "eyes_styles", "crazy_eyes.webp")},
32
+ {"name": "Ojos vacios", "image": os.path.join("assets", "eyes_styles", "empty_eyes.webp")},
33
+ {"name": "Ojos Tareme", "image": os.path.join("assets", "eyes_styles", "tareme_eyes.webp")},
34
+ {"name": "Ojos Tsurime", "image": os.path.join("assets", "eyes_styles", "tsurime_eyes.webp")},
35
+ {"name": "Ojos Jitome", "image": os.path.join("assets", "eyes_styles", "jitome_eyes.webp")},
36
+ {"name": "Ojos Sanpaku", "image": os.path.join("assets", "eyes_styles", "sanpaku_eyes.webp")},
37
+ ]
38
+
39
+ helmets = [
40
+ {"name": "Casco tipo pecera", "image": os.path.join("assets", "helmets", "fishbowl_helmet.webp")},
41
+ {"name": "Casco Sallet", "image": os.path.join("assets", "helmets", "sallet.webp")},
42
+ {"name": "Casco Stahlhelm", "image": os.path.join("assets", "helmets", "stahlhelm.webp")},
43
+ {"name": "Casco Brodie ", "image": os.path.join("assets", "helmets", "brodie_helmet.webp")},
44
+ {"name": "Casco Altyn", "image": os.path.join("assets", "helmets", "altyn_helmet.webp")},
45
+ {"name": "Casco Adrian", "image": os.path.join("assets", "helmets", "adrian_helmet.webp")},
46
+ ]
47
+
48
+ hats = [
49
+ {"name": "Gorra con visera", "image": os.path.join("assets", "hats", "peaked_cap.webp")},
50
+ {"name": "Gorro Shako", "image": os.path.join("assets", "hats", "shako_cap.webp")},
51
+ {"name": "Bicorne", "image": os.path.join("assets", "hats", "bicorne.webp")},
52
+ {"name": "Gat (sombrero)", "image": os.path.join("assets", "hats", "gat_hat.webp")},
53
+ {"name": "Jingasa", "image": os.path.join("assets", "hats", "jingasa.webp")},
54
+ {"name": "Gorro Mob", "image": os.path.join("assets", "hats", "mob_cap.webp")},
55
+ ]
56
+
57
+ COLUMNS = 5
image_guide.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from data_image_guide import hair, texture, eyes_styles, helmets, hats, COLUMNS
3
+
4
+ def render_list(lst, title):
5
+ gr.Markdown(
6
+ f"""
7
+ <h1 style="text-align: center; color: #4F46E5;">🔶 {title}</h1>
8
+ """
9
+ )
10
+ for i in range(0, len(lst), COLUMNS):
11
+ with gr.Row(equal_height=True):
12
+ for item in lst[i:i+COLUMNS]:
13
+ with gr.Column(scale=1, min_width=150):
14
+ gr.Image(item['image'], height=200, width=200)
15
+ gr.Markdown(
16
+ f"""
17
+ <h3 style="text-align: center;">{item['name']}</h3>
18
+ """
19
+ )
20
+
21
+ def create_guide_tab():
22
+ with gr.Blocks(theme=gr.themes.Soft()) as guide_tab:
23
+ render_list(hair, "CORTES DE CABELLO 👩")
24
+
25
+ render_list(texture, "TEXTURA DEL CABELLO 🧒")
26
+
27
+ render_list(eyes_styles, "ESTILOS DE LOS OJOS 👀")
28
+
29
+ render_list(helmets, "CASCOS VARIADOS 🎩")
30
+
31
+ render_list(hats, "SOMBREROS VARIADOS 👒")
32
+
33
+ return guide_tab