Update app.py
Browse files
app.py
CHANGED
|
@@ -9,7 +9,7 @@ import os
|
|
| 9 |
|
| 10 |
#from diffusers import StableDiffusionPipeline
|
| 11 |
|
| 12 |
-
whisper = gr.
|
| 13 |
stable_diffusion = gr.Blocks.load(name="spaces/runwayml/stable-diffusion-v1-5")
|
| 14 |
### ββββββββββββββββββββββββββββββββββββββββ
|
| 15 |
|
|
@@ -126,163 +126,7 @@ def translate_better(audio):
|
|
| 126 |
# tr_flag = flag.flag(transcription.language)
|
| 127 |
# return tr_flag, transcription.text, translation.text
|
| 128 |
|
| 129 |
-
### ββββββββββββββββββββββββββββββββββββββββ
|
| 130 |
|
| 131 |
-
css = """
|
| 132 |
-
.container {
|
| 133 |
-
max-width: 780px;
|
| 134 |
-
margin: auto;
|
| 135 |
-
padding-top: 1.5rem;
|
| 136 |
-
}
|
| 137 |
-
a {
|
| 138 |
-
text-decoration: underline;
|
| 139 |
-
}
|
| 140 |
-
h1 {
|
| 141 |
-
font-weight: 900;
|
| 142 |
-
margin-bottom: 7px;
|
| 143 |
-
text-align: center;
|
| 144 |
-
font-size: 2em;
|
| 145 |
-
margin-bottom: 1em;
|
| 146 |
-
}
|
| 147 |
-
#w2sd_container{
|
| 148 |
-
margin-top: 20px;
|
| 149 |
-
}
|
| 150 |
-
.footer {
|
| 151 |
-
margin-bottom: 45px;
|
| 152 |
-
margin-top: 35px;
|
| 153 |
-
text-align: center;
|
| 154 |
-
border-bottom: 1px solid #e5e5e5;
|
| 155 |
-
}
|
| 156 |
-
.footer>p {
|
| 157 |
-
font-size: .8rem;
|
| 158 |
-
display: inline-block;
|
| 159 |
-
padding: 0 10px;
|
| 160 |
-
transform: translateY(10px);
|
| 161 |
-
background: white;
|
| 162 |
-
}
|
| 163 |
-
.dark .footer {
|
| 164 |
-
border-color: #303030;
|
| 165 |
-
}
|
| 166 |
-
.dark .footer>p {
|
| 167 |
-
background: #0b0f19;
|
| 168 |
-
}
|
| 169 |
-
.tabitem {
|
| 170 |
-
border-bottom-left-radius: 10px;
|
| 171 |
-
border-bottom-right-radius: 10px;
|
| 172 |
-
}
|
| 173 |
-
#record_tab, #upload_tab {
|
| 174 |
-
font-size: 1.2em;
|
| 175 |
-
}
|
| 176 |
-
#record_btn{
|
| 177 |
-
|
| 178 |
-
}
|
| 179 |
-
#record_btn > div > button > span {
|
| 180 |
-
width: 2.375rem;
|
| 181 |
-
height: 2.375rem;
|
| 182 |
-
}
|
| 183 |
-
#record_btn > div > button > span > span {
|
| 184 |
-
width: 2.375rem;
|
| 185 |
-
height: 2.375rem;
|
| 186 |
-
}
|
| 187 |
-
audio {
|
| 188 |
-
margin-bottom: 10px;
|
| 189 |
-
}
|
| 190 |
-
div#record_btn > .mt-6{
|
| 191 |
-
margin-top: 0!important;
|
| 192 |
-
}
|
| 193 |
-
div#record_btn > .mt-6 button {
|
| 194 |
-
font-size: 2em;
|
| 195 |
-
width: 100%;
|
| 196 |
-
padding: 20px;
|
| 197 |
-
height: 160px;
|
| 198 |
-
}
|
| 199 |
-
div#upload_area {
|
| 200 |
-
height: 11.1rem;
|
| 201 |
-
}
|
| 202 |
-
div#upload_area > div.w-full > div {
|
| 203 |
-
min-height: 9rem;
|
| 204 |
-
}
|
| 205 |
-
#check_btn_1, #check_btn_2{
|
| 206 |
-
color: #fff;
|
| 207 |
-
--tw-gradient-from: #4caf50;
|
| 208 |
-
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
|
| 209 |
-
--tw-gradient-to: #4caf50;
|
| 210 |
-
border-color: #8bc34a;
|
| 211 |
-
}
|
| 212 |
-
#magic_btn_1, #magic_btn_2{
|
| 213 |
-
color: #fff;
|
| 214 |
-
--tw-gradient-from: #f44336;
|
| 215 |
-
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
|
| 216 |
-
--tw-gradient-to: #ff9800;
|
| 217 |
-
border-color: #ff9800;
|
| 218 |
-
}
|
| 219 |
-
input::-webkit-inner-spin-button, input::-webkit-outer-spin-button {
|
| 220 |
-
-webkit-appearance: none;
|
| 221 |
-
}
|
| 222 |
-
input[type=number] {
|
| 223 |
-
-moz-appearance: textfield;
|
| 224 |
-
}
|
| 225 |
-
input[type=range] {
|
| 226 |
-
-webkit-appearance: none;
|
| 227 |
-
cursor: pointer;
|
| 228 |
-
height: 1px;
|
| 229 |
-
background: currentColor;
|
| 230 |
-
}
|
| 231 |
-
input[type=range]::-webkit-slider-thumb {
|
| 232 |
-
-webkit-appearance: none;
|
| 233 |
-
width: 0.5em;
|
| 234 |
-
height: 1.2em;
|
| 235 |
-
border-radius: 10px;
|
| 236 |
-
background: currentColor;
|
| 237 |
-
}
|
| 238 |
-
input[type=range]::-moz-range-thumb{
|
| 239 |
-
width: 0.5em;
|
| 240 |
-
height: 1.2em;
|
| 241 |
-
border-radius: 10px;
|
| 242 |
-
background: currentColor;
|
| 243 |
-
}
|
| 244 |
-
div#spoken_lang textarea {
|
| 245 |
-
font-size: 4em;
|
| 246 |
-
line-height: 1em;
|
| 247 |
-
text-align: center;
|
| 248 |
-
}
|
| 249 |
-
div#transcripted {
|
| 250 |
-
flex: 4;
|
| 251 |
-
}
|
| 252 |
-
div#translated textarea {
|
| 253 |
-
font-size: 1.5em;
|
| 254 |
-
line-height: 1.25em;
|
| 255 |
-
}
|
| 256 |
-
#sd_settings {
|
| 257 |
-
margin-bottom: 20px;
|
| 258 |
-
}
|
| 259 |
-
#diffuse_btn {
|
| 260 |
-
color: #fff;
|
| 261 |
-
font-size: 1em;
|
| 262 |
-
margin-bottom: 20px;
|
| 263 |
-
--tw-gradient-from: #4caf50;
|
| 264 |
-
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
|
| 265 |
-
--tw-gradient-to: #4caf50;
|
| 266 |
-
border-color: #8bc34a;
|
| 267 |
-
}
|
| 268 |
-
#notice {
|
| 269 |
-
padding: 20px 14px 10px;
|
| 270 |
-
display: flex;
|
| 271 |
-
align-content: space-evenly;
|
| 272 |
-
gap: 20px;
|
| 273 |
-
line-height: 1em;
|
| 274 |
-
font-size: .8em;
|
| 275 |
-
border: 1px solid #374151;
|
| 276 |
-
border-radius: 10px;
|
| 277 |
-
}
|
| 278 |
-
#about {
|
| 279 |
-
padding: 20px;
|
| 280 |
-
}
|
| 281 |
-
#notice > div {
|
| 282 |
-
flex: 1;
|
| 283 |
-
}
|
| 284 |
-
|
| 285 |
-
"""
|
| 286 |
|
| 287 |
### ββββββββββββββββββββββββββββββββββββββββ
|
| 288 |
|
|
|
|
| 9 |
|
| 10 |
#from diffusers import StableDiffusionPipeline
|
| 11 |
|
| 12 |
+
whisper = gr.Interface.load(name="spaces/sanchit-gandhi/whisper-large-v2")
|
| 13 |
stable_diffusion = gr.Blocks.load(name="spaces/runwayml/stable-diffusion-v1-5")
|
| 14 |
### ββββββββββββββββββββββββββββββββββββββββ
|
| 15 |
|
|
|
|
| 126 |
# tr_flag = flag.flag(transcription.language)
|
| 127 |
# return tr_flag, transcription.text, translation.text
|
| 128 |
|
|
|
|
| 129 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
|
| 131 |
### ββββββββββββββββββββββββββββββββββββββββ
|
| 132 |
|