Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -43,112 +43,246 @@ def save_transcript(text):
|
|
| 43 |
return path
|
| 44 |
|
| 45 |
custom_css = """
|
| 46 |
-
@import url('https://fonts.googleapis.com/css2?family=
|
|
|
|
|
|
|
| 47 |
|
| 48 |
body, .gradio-container {
|
| 49 |
-
background: #
|
| 50 |
-
font-family: '
|
|
|
|
| 51 |
}
|
|
|
|
| 52 |
.gradio-container {
|
| 53 |
-
max-width:
|
| 54 |
margin: 0 auto !important;
|
| 55 |
-
padding:
|
| 56 |
}
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
margin-bottom: 32px;
|
| 64 |
}
|
|
|
|
| 65 |
.prose h1 {
|
| 66 |
-
font-family: '
|
| 67 |
-
font-size:
|
| 68 |
-
font-weight:
|
| 69 |
-
color: #
|
| 70 |
-
letter-spacing: -0.
|
| 71 |
-
line-height: 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
}
|
|
|
|
| 73 |
.prose p {
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
font-weight:
|
| 77 |
-
margin-top:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
}
|
| 79 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
.block {
|
| 81 |
-
background: #
|
| 82 |
-
border: 1px solid #
|
| 83 |
-
border-radius:
|
|
|
|
| 84 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
.block label > span, label > span {
|
| 86 |
-
font-family: '
|
| 87 |
-
font-size: 0.
|
| 88 |
font-weight: 500 !important;
|
| 89 |
-
color: #
|
| 90 |
text-transform: uppercase !important;
|
| 91 |
-
letter-spacing: 0.
|
| 92 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
textarea {
|
| 94 |
background: transparent !important;
|
| 95 |
-
color: #
|
| 96 |
-
font-family: '
|
| 97 |
-
font-size: 0.
|
| 98 |
-
line-height: 1.
|
| 99 |
font-weight: 300 !important;
|
| 100 |
border: none !important;
|
|
|
|
| 101 |
}
|
| 102 |
-
|
| 103 |
-
|
|
|
|
|
|
|
| 104 |
button.primary {
|
| 105 |
-
background: #
|
| 106 |
border: none !important;
|
| 107 |
-
border-radius:
|
| 108 |
-
color: #
|
| 109 |
-
font-family: '
|
| 110 |
-
font-size: 0.
|
| 111 |
-
font-weight:
|
| 112 |
letter-spacing: 0.12em !important;
|
| 113 |
text-transform: uppercase !important;
|
| 114 |
-
padding:
|
| 115 |
transition: all 0.2s ease !important;
|
| 116 |
}
|
|
|
|
| 117 |
button.primary:hover {
|
| 118 |
-
background: #
|
|
|
|
| 119 |
transform: translateY(-1px) !important;
|
| 120 |
-
box-shadow: 0 6px 24px rgba(201,169,110,0.3) !important;
|
| 121 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
button.secondary {
|
| 123 |
background: transparent !important;
|
| 124 |
-
border: 1px solid #
|
| 125 |
-
border-radius:
|
| 126 |
-
color: #
|
| 127 |
-
font-family: '
|
| 128 |
-
font-size: 0.
|
| 129 |
-
font-weight:
|
| 130 |
letter-spacing: 0.12em !important;
|
| 131 |
text-transform: uppercase !important;
|
|
|
|
| 132 |
transition: all 0.2s ease !important;
|
| 133 |
}
|
| 134 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
.tab-nav button {
|
| 136 |
-
font-family: '
|
| 137 |
-
font-size: 0.
|
| 138 |
font-weight: 500 !important;
|
| 139 |
-
letter-spacing: 0.
|
| 140 |
text-transform: uppercase !important;
|
| 141 |
-
color: #
|
| 142 |
background: transparent !important;
|
| 143 |
border: none !important;
|
| 144 |
border-bottom: 2px solid transparent !important;
|
|
|
|
| 145 |
transition: all 0.2s !important;
|
| 146 |
}
|
| 147 |
-
|
| 148 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 149 |
::-webkit-scrollbar-track { background: transparent; }
|
| 150 |
-
::-webkit-scrollbar-thumb { background: #
|
|
|
|
|
|
|
| 151 |
footer { display: none !important; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 152 |
"""
|
| 153 |
|
| 154 |
LANGUAGES = [
|
|
@@ -157,13 +291,14 @@ LANGUAGES = [
|
|
| 157 |
"Korean", "Arabic", "Russian", "Dutch", "Turkish"
|
| 158 |
]
|
| 159 |
|
| 160 |
-
with gr.Blocks(title="
|
|
|
|
| 161 |
gr.Markdown("""
|
| 162 |
-
#
|
| 163 |
-
|
| 164 |
""")
|
| 165 |
|
| 166 |
-
with gr.Row():
|
| 167 |
with gr.Column(scale=1):
|
| 168 |
file_input = gr.File(
|
| 169 |
label="Drop your file here",
|
|
@@ -172,8 +307,8 @@ Turn any video or audio into clean, readable text β powered by OpenAI Whisper.
|
|
| 172 |
with gr.Row():
|
| 173 |
model_choice = gr.Dropdown(
|
| 174 |
choices=["tiny", "base", "small", "medium"],
|
| 175 |
-
value="
|
| 176 |
-
label="Model"
|
| 177 |
)
|
| 178 |
language = gr.Dropdown(
|
| 179 |
choices=LANGUAGES,
|
|
@@ -193,11 +328,15 @@ Turn any video or audio into clean, readable text β powered by OpenAI Whisper.
|
|
| 193 |
with gr.Column(scale=1):
|
| 194 |
with gr.Tabs():
|
| 195 |
with gr.Tab("Transcript"):
|
| 196 |
-
output = gr.Textbox(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 197 |
with gr.Tab("Download"):
|
| 198 |
-
plain_output = gr.Textbox(label="Plain text", lines=
|
| 199 |
download_btn = gr.Button("Save as .txt", variant="secondary")
|
| 200 |
-
download_file = gr.File(label="
|
| 201 |
|
| 202 |
submit_btn.click(
|
| 203 |
fn=transcribe,
|
|
|
|
| 43 |
return path
|
| 44 |
|
| 45 |
custom_css = """
|
| 46 |
+
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700&family=Inter:wght@300;400;500&display=swap');
|
| 47 |
+
|
| 48 |
+
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
| 49 |
|
| 50 |
body, .gradio-container {
|
| 51 |
+
background: #000000 !important;
|
| 52 |
+
font-family: 'Inter', sans-serif !important;
|
| 53 |
+
color: #EFECE3 !important;
|
| 54 |
}
|
| 55 |
+
|
| 56 |
.gradio-container {
|
| 57 |
+
max-width: 1100px !important;
|
| 58 |
margin: 0 auto !important;
|
| 59 |
+
padding: 0 !important;
|
| 60 |
}
|
| 61 |
+
|
| 62 |
+
/* ββ Hero header ββ */
|
| 63 |
+
.prose {
|
| 64 |
+
padding: 64px 48px 48px !important;
|
| 65 |
+
border-bottom: 1px solid #111 !important;
|
| 66 |
+
margin-bottom: 0 !important;
|
|
|
|
| 67 |
}
|
| 68 |
+
|
| 69 |
.prose h1 {
|
| 70 |
+
font-family: 'Syne', sans-serif !important;
|
| 71 |
+
font-size: 4rem !important;
|
| 72 |
+
font-weight: 700 !important;
|
| 73 |
+
color: #EFECE3 !important;
|
| 74 |
+
letter-spacing: -0.03em !important;
|
| 75 |
+
line-height: 1 !important;
|
| 76 |
+
margin-bottom: 0 !important;
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
.prose h1 span {
|
| 80 |
+
color: #58B8FF !important;
|
| 81 |
}
|
| 82 |
+
|
| 83 |
.prose p {
|
| 84 |
+
font-size: 0.88rem !important;
|
| 85 |
+
color: #3066BE !important;
|
| 86 |
+
font-weight: 400 !important;
|
| 87 |
+
margin-top: 12px !important;
|
| 88 |
+
letter-spacing: 0.08em !important;
|
| 89 |
+
text-transform: uppercase !important;
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
/* ββ Main layout ββ */
|
| 93 |
+
.contain, .gap {
|
| 94 |
+
background: transparent !important;
|
| 95 |
+
border: none !important;
|
| 96 |
}
|
| 97 |
+
|
| 98 |
+
.main-row {
|
| 99 |
+
padding: 40px 48px !important;
|
| 100 |
+
gap: 32px !important;
|
| 101 |
+
align-items: flex-start !important;
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
/* ββ All blocks ββ */
|
| 105 |
.block {
|
| 106 |
+
background: #080808 !important;
|
| 107 |
+
border: 1px solid #1a1a1a !important;
|
| 108 |
+
border-radius: 4px !important;
|
| 109 |
+
transition: border-color 0.2s !important;
|
| 110 |
}
|
| 111 |
+
|
| 112 |
+
.block:hover { border-color: #3066BE !important; }
|
| 113 |
+
|
| 114 |
+
/* ββ Labels ββ */
|
| 115 |
.block label > span, label > span {
|
| 116 |
+
font-family: 'Inter', sans-serif !important;
|
| 117 |
+
font-size: 0.68rem !important;
|
| 118 |
font-weight: 500 !important;
|
| 119 |
+
color: #112D4E !important;
|
| 120 |
text-transform: uppercase !important;
|
| 121 |
+
letter-spacing: 0.15em !important;
|
| 122 |
}
|
| 123 |
+
|
| 124 |
+
/* ββ File upload zone ββ */
|
| 125 |
+
.file-upload, [data-testid="file"], .upload-container {
|
| 126 |
+
background: #050505 !important;
|
| 127 |
+
border: 1.5px dashed #1a2a3a !important;
|
| 128 |
+
border-radius: 4px !important;
|
| 129 |
+
transition: all 0.25s !important;
|
| 130 |
+
min-height: 160px !important;
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
.file-upload:hover, [data-testid="file"]:hover {
|
| 134 |
+
border-color: #3066BE !important;
|
| 135 |
+
background: #060d1a !important;
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
.file-upload .wrap {
|
| 139 |
+
display: flex !important;
|
| 140 |
+
flex-direction: column !important;
|
| 141 |
+
align-items: center !important;
|
| 142 |
+
justify-content: center !important;
|
| 143 |
+
gap: 10px !important;
|
| 144 |
+
padding: 40px !important;
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
.file-upload .wrap svg {
|
| 148 |
+
color: #3066BE !important;
|
| 149 |
+
width: 28px !important;
|
| 150 |
+
height: 28px !important;
|
| 151 |
+
opacity: 0.6 !important;
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
.file-upload .wrap span {
|
| 155 |
+
font-size: 0.82rem !important;
|
| 156 |
+
color: #2a3a4a !important;
|
| 157 |
+
font-family: 'Inter', sans-serif !important;
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
/* ββ Dropdowns ββ */
|
| 161 |
+
.wrap-inner, select {
|
| 162 |
+
background: #080808 !important;
|
| 163 |
+
border: 1px solid #1a1a1a !important;
|
| 164 |
+
border-radius: 4px !important;
|
| 165 |
+
color: #EFECE3 !important;
|
| 166 |
+
font-family: 'Inter', sans-serif !important;
|
| 167 |
+
font-size: 0.85rem !important;
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
/* ββ Radio buttons ββ */
|
| 171 |
+
.wrap.svelte-12cmxck, .wrap.svelte-1p9xokt {
|
| 172 |
+
gap: 8px !important;
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
input[type="radio"] { accent-color: #3066BE !important; }
|
| 176 |
+
input[type="checkbox"] { accent-color: #3066BE !important; }
|
| 177 |
+
|
| 178 |
+
.radio-group label, .checkbox-group label {
|
| 179 |
+
font-size: 0.82rem !important;
|
| 180 |
+
color: #EFECE3 !important;
|
| 181 |
+
font-family: 'Inter', sans-serif !important;
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
/* ββ Textarea / output ββ */
|
| 185 |
textarea {
|
| 186 |
background: transparent !important;
|
| 187 |
+
color: #EFECE3 !important;
|
| 188 |
+
font-family: 'Inter', sans-serif !important;
|
| 189 |
+
font-size: 0.9rem !important;
|
| 190 |
+
line-height: 1.9 !important;
|
| 191 |
font-weight: 300 !important;
|
| 192 |
border: none !important;
|
| 193 |
+
letter-spacing: 0.01em !important;
|
| 194 |
}
|
| 195 |
+
|
| 196 |
+
textarea::placeholder { color: #1a1a1a !important; }
|
| 197 |
+
|
| 198 |
+
/* ββ Primary button ββ */
|
| 199 |
button.primary {
|
| 200 |
+
background: #3066BE !important;
|
| 201 |
border: none !important;
|
| 202 |
+
border-radius: 4px !important;
|
| 203 |
+
color: #F9F7F7 !important;
|
| 204 |
+
font-family: 'Syne', sans-serif !important;
|
| 205 |
+
font-size: 0.82rem !important;
|
| 206 |
+
font-weight: 600 !important;
|
| 207 |
letter-spacing: 0.12em !important;
|
| 208 |
text-transform: uppercase !important;
|
| 209 |
+
padding: 15px 32px !important;
|
| 210 |
transition: all 0.2s ease !important;
|
| 211 |
}
|
| 212 |
+
|
| 213 |
button.primary:hover {
|
| 214 |
+
background: #58B8FF !important;
|
| 215 |
+
color: #000000 !important;
|
| 216 |
transform: translateY(-1px) !important;
|
|
|
|
| 217 |
}
|
| 218 |
+
|
| 219 |
+
button.primary:active { transform: translateY(0) !important; }
|
| 220 |
+
|
| 221 |
+
/* ββ Secondary button ββ */
|
| 222 |
button.secondary {
|
| 223 |
background: transparent !important;
|
| 224 |
+
border: 1px solid #1a1a1a !important;
|
| 225 |
+
border-radius: 4px !important;
|
| 226 |
+
color: #2a3a4a !important;
|
| 227 |
+
font-family: 'Syne', sans-serif !important;
|
| 228 |
+
font-size: 0.82rem !important;
|
| 229 |
+
font-weight: 600 !important;
|
| 230 |
letter-spacing: 0.12em !important;
|
| 231 |
text-transform: uppercase !important;
|
| 232 |
+
padding: 15px 32px !important;
|
| 233 |
transition: all 0.2s ease !important;
|
| 234 |
}
|
| 235 |
+
|
| 236 |
+
button.secondary:hover {
|
| 237 |
+
border-color: #3066BE !important;
|
| 238 |
+
color: #58B8FF !important;
|
| 239 |
+
}
|
| 240 |
+
|
| 241 |
+
/* ββ Tabs ββ */
|
| 242 |
+
.tab-nav {
|
| 243 |
+
border-bottom: 1px solid #111 !important;
|
| 244 |
+
margin-bottom: 0 !important;
|
| 245 |
+
}
|
| 246 |
+
|
| 247 |
.tab-nav button {
|
| 248 |
+
font-family: 'Inter', sans-serif !important;
|
| 249 |
+
font-size: 0.72rem !important;
|
| 250 |
font-weight: 500 !important;
|
| 251 |
+
letter-spacing: 0.12em !important;
|
| 252 |
text-transform: uppercase !important;
|
| 253 |
+
color: #2a3a4a !important;
|
| 254 |
background: transparent !important;
|
| 255 |
border: none !important;
|
| 256 |
border-bottom: 2px solid transparent !important;
|
| 257 |
+
padding: 12px 20px !important;
|
| 258 |
transition: all 0.2s !important;
|
| 259 |
}
|
| 260 |
+
|
| 261 |
+
.tab-nav button.selected {
|
| 262 |
+
color: #58B8FF !important;
|
| 263 |
+
border-bottom-color: #58B8FF !important;
|
| 264 |
+
}
|
| 265 |
+
|
| 266 |
+
/* ββ Progress bar ββ */
|
| 267 |
+
.progress-bar { background: #3066BE !important; }
|
| 268 |
+
.progress-bar-wrap { background: #111 !important; border-radius: 0 !important; }
|
| 269 |
+
|
| 270 |
+
/* ββ Scrollbar ββ */
|
| 271 |
+
::-webkit-scrollbar { width: 2px; }
|
| 272 |
::-webkit-scrollbar-track { background: transparent; }
|
| 273 |
+
::-webkit-scrollbar-thumb { background: #1a2a3a; border-radius: 0; }
|
| 274 |
+
|
| 275 |
+
/* ββ Footer ββ */
|
| 276 |
footer { display: none !important; }
|
| 277 |
+
|
| 278 |
+
/* ββ Bottom credit bar ββ */
|
| 279 |
+
.credit-bar {
|
| 280 |
+
padding: 20px 48px !important;
|
| 281 |
+
border-top: 1px solid #0a0a0a !important;
|
| 282 |
+
display: flex !important;
|
| 283 |
+
align-items: center !important;
|
| 284 |
+
justify-content: space-between !important;
|
| 285 |
+
}
|
| 286 |
"""
|
| 287 |
|
| 288 |
LANGUAGES = [
|
|
|
|
| 291 |
"Korean", "Arabic", "Russian", "Dutch", "Turkish"
|
| 292 |
]
|
| 293 |
|
| 294 |
+
with gr.Blocks(title="Kalp Transcript β Kalpi Edition") as demo:
|
| 295 |
+
|
| 296 |
gr.Markdown("""
|
| 297 |
+
# Kalp <span>Transcript</span>
|
| 298 |
+
Created by Kalpi Edition
|
| 299 |
""")
|
| 300 |
|
| 301 |
+
with gr.Row(elem_classes=["main-row"]):
|
| 302 |
with gr.Column(scale=1):
|
| 303 |
file_input = gr.File(
|
| 304 |
label="Drop your file here",
|
|
|
|
| 307 |
with gr.Row():
|
| 308 |
model_choice = gr.Dropdown(
|
| 309 |
choices=["tiny", "base", "small", "medium"],
|
| 310 |
+
value="tiny",
|
| 311 |
+
label="Model β tiny = fastest Β· medium = best accuracy"
|
| 312 |
)
|
| 313 |
language = gr.Dropdown(
|
| 314 |
choices=LANGUAGES,
|
|
|
|
| 328 |
with gr.Column(scale=1):
|
| 329 |
with gr.Tabs():
|
| 330 |
with gr.Tab("Transcript"):
|
| 331 |
+
output = gr.Textbox(
|
| 332 |
+
label="",
|
| 333 |
+
lines=18,
|
| 334 |
+
placeholder="Your transcript will appear here..."
|
| 335 |
+
)
|
| 336 |
with gr.Tab("Download"):
|
| 337 |
+
plain_output = gr.Textbox(label="Plain text", lines=12, visible=False)
|
| 338 |
download_btn = gr.Button("Save as .txt", variant="secondary")
|
| 339 |
+
download_file = gr.File(label="")
|
| 340 |
|
| 341 |
submit_btn.click(
|
| 342 |
fn=transcribe,
|