Blakus commited on
Commit
fee8703
1 Parent(s): 60b3d63

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -7
app.py CHANGED
@@ -4,6 +4,8 @@ import time
4
  import sys
5
  import subprocess
6
  import scipy.io.wavfile as wavfile
 
 
7
  import gradio as gr
8
  from TTS.api import TTS
9
  from TTS.tts.configs.xtts_config import XttsConfig
@@ -39,9 +41,11 @@ config = XttsConfig()
39
  config.load_json(config_path)
40
 
41
  model = Xtts.init_from_config(config)
42
- model.load_checkpoint(config, checkpoint_path=checkpoint_path, vocab_path=vocab_path, eval=True, use_deepspeed=False)
43
 
44
- print("Modelo cargado en CPU")
 
 
45
 
46
  def predict(prompt, language, reference_audio):
47
  try:
@@ -125,11 +129,25 @@ with gr.Blocks(theme=theme) as demo:
125
  gr.Markdown(description)
126
 
127
  with gr.Row():
128
- gr.Image("https://i1.sndcdn.com/artworks-000237574740-gwz61j-t500x500.jpg",
129
- label="",
130
- show_label=False,
131
- container=False, # Esto permite que la imagen se ajuste al contenedor
132
- height="auto") # Altura automática para mantener la relación de aspecto
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
 
134
  with gr.Row():
135
  with gr.Column(scale=2):
 
4
  import sys
5
  import subprocess
6
  import scipy.io.wavfile as wavfile
7
+ import torch
8
+ import torchaudio
9
  import gradio as gr
10
  from TTS.api import TTS
11
  from TTS.tts.configs.xtts_config import XttsConfig
 
41
  config.load_json(config_path)
42
 
43
  model = Xtts.init_from_config(config)
44
+ model.load_checkpoint(config, checkpoint_path=checkpoint_path, vocab_path=vocab_path, eval=True, use_deepspeed=True)
45
 
46
+ model.cuda()
47
+
48
+ print("Modelo cargado en GPU")
49
 
50
  def predict(prompt, language, reference_audio):
51
  try:
 
129
  gr.Markdown(description)
130
 
131
  with gr.Row():
132
+ with gr.Column(equal_height=True): # Esto centra la imagen en la fila
133
+ gr.Image(
134
+ "https://www.labattaglia.com.ar/images/about_me_pic2.jpg",
135
+ label="",
136
+ show_label=False,
137
+ container=False, # Esto permite que la imagen se ajuste al contenedor
138
+ elem_id="image-container" # Asigna un ID CSS para agregar estilos personalizados
139
+ )
140
+
141
+ # Agregamos estilos CSS personalizados
142
+ demo.css = """
143
+ #image-container img {
144
+ display: block;
145
+ margin-left: auto;
146
+ margin-right: auto;
147
+ max-width: 256px; /* Ancho máximo de 256px */
148
+ height: auto; /* Mantener la relación de aspecto */
149
+ }
150
+ """
151
 
152
  with gr.Row():
153
  with gr.Column(scale=2):