ANASAKHTAR commited on
Commit
7f7de8d
·
verified ·
1 Parent(s): b41ca4e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -25
app.py CHANGED
@@ -72,9 +72,9 @@ def transcribe_audio(audio_file, destination_language):
72
  # Gradio interface
73
  with gr.Blocks(css="""
74
  body {
75
- background: linear-gradient(to right, #1e3c72, #2a5298); /* Professional gradient */
76
  font-family: 'Roboto', sans-serif; /* Modern font for readability */
77
- color: #ffffff; /* White text for high contrast */
78
  display: flex;
79
  justify-content: center;
80
  align-items: center;
@@ -83,7 +83,7 @@ body {
83
  padding: 0;
84
  }
85
  h1, h2, h3, label {
86
- color: #ffffff; /* Ensure headings and labels are visible */
87
  text-align: center;
88
  }
89
  button {
@@ -147,32 +147,30 @@ input:focus, textarea:focus, select:focus {
147
 
148
  with gr.Tabs():
149
  with gr.Tab("Text Translation"):
150
- with gr.Column(scale=1):
151
- text_input = gr.Textbox(label="Enter Text", lines=6, placeholder="Type something... in English")
152
- language_dropdown = gr.Dropdown(
153
- choices=available_languages, label="Destination Language"
154
- )
155
- translated_text_output = gr.Textbox(label="Translated Text", lines=4, interactive=False)
156
- translate_button = gr.Button("Translate")
157
 
158
- translate_button.click(
159
- translate_text, inputs=[text_input, language_dropdown], outputs=[translated_text_output]
160
- )
161
 
162
  with gr.Tab("Audio Translation"):
163
- with gr.Column(scale=1):
164
- audio_input = gr.Audio(label="Upload Audio File", type="filepath")
165
- audio_language_dropdown = gr.Dropdown(
166
- choices=available_languages, label="Destination Language"
167
- )
168
- audio_translated_text_output = gr.Textbox(label="Transcribed & Translated Text", lines=4, interactive=False)
169
- audio_translate_button = gr.Button("Transcribe & Translate")
170
 
171
- audio_translate_button.click(
172
- transcribe_audio,
173
- inputs=[audio_input, audio_language_dropdown],
174
- outputs=[audio_translated_text_output],
175
- )
176
 
177
  if __name__ == "__main__":
178
  demo.launch()
 
72
  # Gradio interface
73
  with gr.Blocks(css="""
74
  body {
75
+ background: #f0f0f0; /* Light gray background */
76
  font-family: 'Roboto', sans-serif; /* Modern font for readability */
77
+ color: #333333; /* Dark text color for better readability */
78
  display: flex;
79
  justify-content: center;
80
  align-items: center;
 
83
  padding: 0;
84
  }
85
  h1, h2, h3, label {
86
+ color: #333333; /* Ensure headings and labels are visible */
87
  text-align: center;
88
  }
89
  button {
 
147
 
148
  with gr.Tabs():
149
  with gr.Tab("Text Translation"):
150
+ text_input = gr.Textbox(label="Input Text", lines=6, placeholder="Enter your text here...")
151
+ language_dropdown = gr.Dropdown(
152
+ choices=available_languages, label="Select Destination Language"
153
+ )
154
+ translated_text_output = gr.Textbox(label="Translated Text", lines=4)
155
+ translate_button = gr.Button("Translate")
 
156
 
157
+ translate_button.click(
158
+ translate_text, inputs=[text_input, language_dropdown], outputs=[translated_text_output]
159
+ )
160
 
161
  with gr.Tab("Audio Translation"):
162
+ audio_input = gr.Audio(label="Upload Audio File", type="filepath")
163
+ audio_language_dropdown = gr.Dropdown(
164
+ choices=available_languages, label="Select Destination Language"
165
+ )
166
+ audio_translated_text_output = gr.Textbox(label="Transcribed and Translated Text", lines=4)
167
+ audio_translate_button = gr.Button("Transcribe and Translate")
 
168
 
169
+ audio_translate_button.click(
170
+ transcribe_audio,
171
+ inputs=[audio_input, audio_language_dropdown],
172
+ outputs=[audio_translated_text_output],
173
+ )
174
 
175
  if __name__ == "__main__":
176
  demo.launch()