fabiolamp commited on
Commit
5c912e7
·
verified ·
1 Parent(s): 8db0b4a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +71 -31
app.py CHANGED
@@ -78,68 +78,108 @@ def run_inference(input_image, input_audio=None, input_text=None):
78
  return audio_video()
79
 
80
 
81
- import gradio as gr
82
-
83
- def run_inference(image, audio, text):
84
- # Aquí pones tu lógica real de generación de video
85
- # De momento devuelve None si no hay output
86
- return None
87
-
88
  def run():
89
  custom_css = """
90
- /* Estilo simplificado compatible con Gradio 4.29 */
91
- .gradio-container {
 
 
 
92
  background-color: #ffffff !important;
93
- min-height: 100vh;
94
- font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
95
  }
 
 
96
  #main-container {
97
  background-color: #ffffff !important;
98
  border-radius: 15px;
99
- padding: 40px;
 
100
  margin: 40px auto;
101
  max-width: 1100px;
102
  }
 
 
103
  .title-container {
104
- background-color: #ffffff !important;
105
  text-align: center !important;
106
  margin-bottom: 40px;
107
  }
108
  h1 {
109
- text-align: center !important;
110
  color: #2c3e50;
111
- font-size: 2.8em;
112
  font-weight: 700;
 
113
  }
114
  .subtitle {
115
  color: #7f8c8d;
116
- font-size: 1.3em;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  }
118
  """
119
 
120
  with gr.Blocks(css=custom_css) as demo:
121
  with gr.Group(elem_id="main-container"):
 
 
122
  with gr.Row(elem_classes="title-container"):
123
- gr.Markdown("<h1>Talkie</h1><div class='subtitle'>Upload an image, add some audio or text, and watch the magic happen! ✨</div>")
 
 
 
124
 
125
- with gr.Row():
126
- with gr.Column(scale=1):
127
- input_image = gr.Image(label="📸 Your image")
128
- with gr.Column(scale=1):
129
- input_audio = gr.Audio(label="🎵 Your audio (Optional)")
130
- input_text = gr.Textbox(label="💭 Your text", placeholder="Type your text here to convert it to speech...")
 
 
131
 
132
- btn = gr.Button("GENERATE")
133
- video_out = gr.Video(label="🎥 Your video")
 
134
 
135
- btn.click(run_inference, inputs=[input_image, input_audio, input_text], outputs=[video_out])
 
 
136
 
 
137
  demo.queue()
138
- # No se pone share=True, ni server_name/port: Spaces se encarga de eso
139
  demo.launch()
140
 
141
  if __name__ == "__main__":
142
- run()
143
-
144
-
145
-
 
78
  return audio_video()
79
 
80
 
 
 
 
 
 
 
 
81
  def run():
82
  custom_css = """
83
+ /* Fondo general blanco */
84
+ .gradio-container,
85
+ .gr-block,
86
+ .gr-row,
87
+ .gr-column {
88
  background-color: #ffffff !important;
89
+ border: none !important;
 
90
  }
91
+
92
+ /* Contenedor principal */
93
  #main-container {
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: 1100px;
100
  }
101
+
102
+ /* Títulos */
103
  .title-container {
 
104
  text-align: center !important;
105
  margin-bottom: 40px;
106
  }
107
  h1 {
 
108
  color: #2c3e50;
109
+ font-size: 2.6em;
110
  font-weight: 700;
111
+ margin-bottom: 10px;
112
  }
113
  .subtitle {
114
  color: #7f8c8d;
115
+ font-size: 1.2em;
116
+ }
117
+
118
+ /* Botón gris moderno */
119
+ .generate-btn {
120
+ background: linear-gradient(90deg, #a8a8a8, #7d7d7d);
121
+ color: #ffffff !important;
122
+ font-size: 1.1em;
123
+ font-weight: 600;
124
+ padding: 14px 32px;
125
+ border-radius: 10px;
126
+ border: none !important;
127
+ cursor: pointer;
128
+ transition: all 0.25s ease;
129
+ margin-top: 20px;
130
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
131
+ }
132
+
133
+ .generate-btn:hover {
134
+ background: linear-gradient(90deg, #b3b3b3, #8a8a8a);
135
+ transform: translateY(-2px);
136
+ box-shadow: 0 8px 18px rgba(0,0,0,0.2);
137
+ }
138
+
139
+ /* Filas y vídeo */
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%;
149
+ height: auto;
150
  }
151
  """
152
 
153
  with gr.Blocks(css=custom_css) as demo:
154
  with gr.Group(elem_id="main-container"):
155
+
156
+ # Título
157
  with gr.Row(elem_classes="title-container"):
158
+ gr.Markdown("""
159
+ <h1>Talkie</h1>
160
+ <div class='subtitle'>Upload an image, add some audio or text, and watch the magic happen! ✨</div>
161
+ """)
162
 
163
+ # Imagen sola
164
+ with gr.Row(elem_classes="input-container"):
165
+ input_image = gr.Image(label="📸 Your image")
166
+
167
+ # Audio + texto
168
+ with gr.Row(elem_classes="input-container"):
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 gris bonito
173
+ with gr.Row():
174
+ btn = gr.Button("GENERATE", elem_classes="generate-btn")
175
 
176
+ # Video separado
177
+ with gr.Row(elem_classes="output-container"):
178
+ video_out = gr.Video(label="🎥 Your video", show_label=True, elem_classes="output-video")
179
 
180
+ btn.click(run_inference, inputs=[input_image, input_audio, input_text], outputs=[video_out])
181
  demo.queue()
 
182
  demo.launch()
183
 
184
  if __name__ == "__main__":
185
+ run()