Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -75,9 +75,16 @@ 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 |
}
|
79 |
h1, h2, h3, label {
|
80 |
color: #ffffff; /* Ensure headings and labels are visible */
|
|
|
81 |
}
|
82 |
button {
|
83 |
background-color: #4caf50; /* Professional green */
|
@@ -103,6 +110,32 @@ input, textarea, select {
|
|
103 |
input:focus, textarea:focus, select:focus {
|
104 |
border-color: #4caf50; /* Highlight input fields on focus */
|
105 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
""") as demo:
|
107 |
with gr.Row():
|
108 |
gr.Markdown(
|
@@ -114,30 +147,32 @@ input:focus, textarea:focus, select:focus {
|
|
114 |
|
115 |
with gr.Tabs():
|
116 |
with gr.Tab("Text Translation"):
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
|
|
123 |
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
|
128 |
with gr.Tab("Audio Translation"):
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
|
|
135 |
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
|
142 |
if __name__ == "__main__":
|
143 |
demo.launch()
|
|
|
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;
|
81 |
+
height: 100vh;
|
82 |
+
margin: 0;
|
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 {
|
90 |
background-color: #4caf50; /* Professional green */
|
|
|
110 |
input:focus, textarea:focus, select:focus {
|
111 |
border-color: #4caf50; /* Highlight input fields on focus */
|
112 |
}
|
113 |
+
.chat-container {
|
114 |
+
background: rgba(0, 0, 0, 0.5);
|
115 |
+
padding: 20px;
|
116 |
+
border-radius: 15px;
|
117 |
+
max-width: 600px;
|
118 |
+
width: 100%;
|
119 |
+
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
|
120 |
+
display: flex;
|
121 |
+
flex-direction: column;
|
122 |
+
}
|
123 |
+
.message {
|
124 |
+
background: #2a5298;
|
125 |
+
padding: 12px 18px;
|
126 |
+
border-radius: 15px;
|
127 |
+
margin: 5px 0;
|
128 |
+
max-width: 80%;
|
129 |
+
word-wrap: break-word;
|
130 |
+
color: #fff;
|
131 |
+
}
|
132 |
+
.message.user {
|
133 |
+
background: #4caf50;
|
134 |
+
align-self: flex-end;
|
135 |
+
}
|
136 |
+
.message.bot {
|
137 |
+
background: #1e3c72;
|
138 |
+
}
|
139 |
""") as demo:
|
140 |
with gr.Row():
|
141 |
gr.Markdown(
|
|
|
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()
|