Zguin commited on
Commit
388f62c
·
verified ·
1 Parent(s): ecf182d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -5
app.py CHANGED
@@ -86,19 +86,47 @@ def generate_audio(english_caption: str, russian_caption: str, audio_language: s
86
  text = russian_caption if audio_language == "Русский" else english_caption
87
  return pipeline.generate_audio(text, audio_language)
88
 
89
- with gr.Blocks(css=".btn {width: 200px; background-color: #4B0082; color: white; border: none; padding: 10px 20px; text-align: center; font-size: 16px; margin: 0 auto; display: block;} .equal-height {height: 80px !important;}") as iface:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  with gr.Row():
91
  with gr.Column(scale=1, min_width=400, variant="panel"):
92
  image = gr.Image(type="pil", label="Изображение", height=400, width=400)
93
  submit_button = gr.Button("Сгенерировать описание", elem_classes="btn")
 
94
  with gr.Column(scale=1, min_width=300):
95
  english_caption = gr.Textbox(label="Описание на English:", lines=2)
96
  russian_caption = gr.Textbox(label="Описание на Русском:", lines=2)
97
- with gr.Row():
98
- with gr.Column(scale=1):
 
99
  with gr.Row():
100
- audio_language = gr.Dropdown(choices=["Русский", "English"], label="Язык озвучки", value="Русский", elem_classes="equal-height")
101
- audio_output = gr.Audio(label="Озвучка", elem_classes="equal-height")
 
 
 
 
 
 
 
 
102
  audio_button = gr.Button("Сгенерировать озвучку", elem_classes="btn")
103
 
104
  submit_button.click(
 
86
  text = russian_caption if audio_language == "Русский" else english_caption
87
  return pipeline.generate_audio(text, audio_language)
88
 
89
+ with gr.Blocks(css="""
90
+ .btn {
91
+ width: 200px;
92
+ background-color: #4B0082;
93
+ color: white;
94
+ border: none;
95
+ padding: 10px 20px;
96
+ text-align: center;
97
+ font-size: 16px;
98
+ margin: 0 auto;
99
+ display: block;
100
+ }
101
+ .equal-height {
102
+ height: 100px !important;
103
+ }
104
+ .audio-controls {
105
+ margin-top: 20px;
106
+ }
107
+ """) as iface:
108
  with gr.Row():
109
  with gr.Column(scale=1, min_width=400, variant="panel"):
110
  image = gr.Image(type="pil", label="Изображение", height=400, width=400)
111
  submit_button = gr.Button("Сгенерировать описание", elem_classes="btn")
112
+
113
  with gr.Column(scale=1, min_width=300):
114
  english_caption = gr.Textbox(label="Описание на English:", lines=2)
115
  russian_caption = gr.Textbox(label="Описание на Русском:", lines=2)
116
+
117
+ # Блок с элементами озвучки
118
+ with gr.Column(scale=1, elem_classes="audio-controls"):
119
  with gr.Row():
120
+ audio_language = gr.Dropdown(
121
+ choices=["Русский", "English"],
122
+ label="Язык озвучки",
123
+ value="Русский",
124
+ elem_classes="equal-height"
125
+ )
126
+ audio_output = gr.Audio(
127
+ label="Озвучка",
128
+ elem_classes="equal-height"
129
+ )
130
  audio_button = gr.Button("Сгенерировать озвучку", elem_classes="btn")
131
 
132
  submit_button.click(