Update app.py
Browse files
app.py
CHANGED
|
@@ -80,37 +80,38 @@ def run_inference(input_image, input_audio=None, input_text=None):
|
|
| 80 |
|
| 81 |
def run():
|
| 82 |
custom_css = """
|
| 83 |
-
/* Fondo general
|
| 84 |
-
.gradio-container
|
| 85 |
-
.gr-block,
|
| 86 |
-
.gr-row,
|
| 87 |
-
.gr-column {
|
| 88 |
background-color: #ffffff !important;
|
| 89 |
-
|
| 90 |
}
|
| 91 |
|
| 92 |
/* Contenedor principal */
|
| 93 |
-
|
| 94 |
background-color: #ffffff !important;
|
| 95 |
border-radius: 15px;
|
| 96 |
padding: 40px 50px;
|
| 97 |
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
|
| 98 |
margin: 40px auto;
|
| 99 |
-
max-width:
|
| 100 |
}
|
| 101 |
|
| 102 |
-
/*
|
| 103 |
.title-container {
|
| 104 |
-
text-align: center
|
| 105 |
-
margin-bottom:
|
| 106 |
}
|
|
|
|
| 107 |
h1 {
|
|
|
|
| 108 |
color: #2c3e50;
|
| 109 |
-
font-size: 2.
|
| 110 |
font-weight: 700;
|
| 111 |
margin-bottom: 10px;
|
| 112 |
}
|
|
|
|
| 113 |
.subtitle {
|
|
|
|
| 114 |
color: #7f8c8d;
|
| 115 |
font-size: 1.2em;
|
| 116 |
}
|
|
@@ -126,7 +127,7 @@ def run():
|
|
| 126 |
border: none !important;
|
| 127 |
cursor: pointer;
|
| 128 |
transition: all 0.25s ease;
|
| 129 |
-
margin-top:
|
| 130 |
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
| 131 |
}
|
| 132 |
|
|
@@ -136,13 +137,7 @@ def run():
|
|
| 136 |
box-shadow: 0 8px 18px rgba(0,0,0,0.2);
|
| 137 |
}
|
| 138 |
|
| 139 |
-
/*
|
| 140 |
-
.input-container, .output-container {
|
| 141 |
-
margin-bottom: 25px;
|
| 142 |
-
width: 100%;
|
| 143 |
-
display: flex;
|
| 144 |
-
justify-content: center;
|
| 145 |
-
}
|
| 146 |
.output-video video {
|
| 147 |
border-radius: 10px;
|
| 148 |
max-width: 100%;
|
|
@@ -151,36 +146,36 @@ def run():
|
|
| 151 |
"""
|
| 152 |
|
| 153 |
with gr.Blocks(css=custom_css) as demo:
|
| 154 |
-
with gr.
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
"""
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
|
| 167 |
# Audio + texto
|
| 168 |
-
with gr.Row(
|
| 169 |
input_audio = gr.Audio(label="🎵 Your audio (Optional)")
|
| 170 |
input_text = gr.Textbox(label="💭 Your text", placeholder="Type your text here...")
|
| 171 |
|
| 172 |
-
# Botón
|
| 173 |
-
|
| 174 |
-
btn = gr.Button("GENERATE", elem_classes="generate-btn")
|
| 175 |
-
btn.click(run_inference, inputs=[input_image, input_audio, input_text], outputs=[video_out])
|
| 176 |
|
| 177 |
-
#
|
| 178 |
-
|
| 179 |
-
|
|
|
|
|
|
|
| 180 |
|
| 181 |
-
|
| 182 |
demo.queue()
|
| 183 |
demo.launch()
|
| 184 |
|
|
|
|
| 185 |
if __name__ == "__main__":
|
| 186 |
run()
|
|
|
|
| 80 |
|
| 81 |
def run():
|
| 82 |
custom_css = """
|
| 83 |
+
/* Fondo blanco general */
|
| 84 |
+
.gradio-container {
|
|
|
|
|
|
|
|
|
|
| 85 |
background-color: #ffffff !important;
|
| 86 |
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
| 87 |
}
|
| 88 |
|
| 89 |
/* Contenedor principal */
|
| 90 |
+
.main-container {
|
| 91 |
background-color: #ffffff !important;
|
| 92 |
border-radius: 15px;
|
| 93 |
padding: 40px 50px;
|
| 94 |
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
|
| 95 |
margin: 40px auto;
|
| 96 |
+
max-width: 1000px;
|
| 97 |
}
|
| 98 |
|
| 99 |
+
/* Título */
|
| 100 |
.title-container {
|
| 101 |
+
text-align: center;
|
| 102 |
+
margin-bottom: 30px;
|
| 103 |
}
|
| 104 |
+
|
| 105 |
h1 {
|
| 106 |
+
text-align: center;
|
| 107 |
color: #2c3e50;
|
| 108 |
+
font-size: 2.4em;
|
| 109 |
font-weight: 700;
|
| 110 |
margin-bottom: 10px;
|
| 111 |
}
|
| 112 |
+
|
| 113 |
.subtitle {
|
| 114 |
+
text-align: center;
|
| 115 |
color: #7f8c8d;
|
| 116 |
font-size: 1.2em;
|
| 117 |
}
|
|
|
|
| 127 |
border: none !important;
|
| 128 |
cursor: pointer;
|
| 129 |
transition: all 0.25s ease;
|
| 130 |
+
margin-top: 15px;
|
| 131 |
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
| 132 |
}
|
| 133 |
|
|
|
|
| 137 |
box-shadow: 0 8px 18px rgba(0,0,0,0.2);
|
| 138 |
}
|
| 139 |
|
| 140 |
+
/* Centrar video */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
.output-video video {
|
| 142 |
border-radius: 10px;
|
| 143 |
max-width: 100%;
|
|
|
|
| 146 |
"""
|
| 147 |
|
| 148 |
with gr.Blocks(css=custom_css) as demo:
|
| 149 |
+
with gr.Box(elem_classes=["main-container"]):
|
| 150 |
+
gr.Markdown(
|
| 151 |
+
"""
|
| 152 |
+
<div class='title-container'>
|
| 153 |
+
<h1>Talkie</h1>
|
| 154 |
+
<div class='subtitle'>Upload an image, add some audio or text, and watch the magic happen! ✨</div>
|
| 155 |
+
</div>
|
| 156 |
+
"""
|
| 157 |
+
)
|
| 158 |
+
|
| 159 |
+
# Imagen
|
| 160 |
+
input_image = gr.Image(label="📸 Your image")
|
| 161 |
|
| 162 |
# Audio + texto
|
| 163 |
+
with gr.Row():
|
| 164 |
input_audio = gr.Audio(label="🎵 Your audio (Optional)")
|
| 165 |
input_text = gr.Textbox(label="💭 Your text", placeholder="Type your text here...")
|
| 166 |
|
| 167 |
+
# Botón
|
| 168 |
+
btn = gr.Button("GENERATE", elem_classes=["generate-btn"])
|
|
|
|
|
|
|
| 169 |
|
| 170 |
+
# Salida de video
|
| 171 |
+
video_out = gr.Video(label="🎥 Your video", show_label=True, elem_classes=["output-video"])
|
| 172 |
+
|
| 173 |
+
# Conexión del botón (fuera del bloque visual)
|
| 174 |
+
btn.click(run_inference, inputs=[input_image, input_audio, input_text], outputs=video_out)
|
| 175 |
|
|
|
|
| 176 |
demo.queue()
|
| 177 |
demo.launch()
|
| 178 |
|
| 179 |
+
|
| 180 |
if __name__ == "__main__":
|
| 181 |
run()
|