Update app.py
Browse files
app.py
CHANGED
|
@@ -516,9 +516,26 @@ async def text_to_speech_edge(text, language_code, speaker, tashkeel_checkbox=Fa
|
|
| 516 |
|
| 517 |
# Update the download link HTML structure
|
| 518 |
download_html = f"""
|
| 519 |
-
<a href="https://hivecorp-w-t-p-01.hf.space/gradio_api/file={tmp_path}"
|
| 520 |
-
|
| 521 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 522 |
"""
|
| 523 |
|
| 524 |
return text, tmp_path, download_html
|
|
|
|
| 516 |
|
| 517 |
# Update the download link HTML structure
|
| 518 |
download_html = f"""
|
| 519 |
+
<a href="https://hivecorp-w-t-p-01.hf.space/gradio_api/file={tmp_path}"
|
| 520 |
+
download="{Path(tmp_path).name}"
|
| 521 |
+
target="_blank"
|
| 522 |
+
rel="noopener noreferrer"
|
| 523 |
+
style="display: inline-block; padding: 10px 20px; background: linear-gradient(135deg, #4776E6, #8E54E9); color: white; text-decoration: none; border-radius: 8px; font-weight: 600; transition: all 0.3s ease;"
|
| 524 |
+
onmouseover="this.style.transform='translateY(-2px)'; this.style.boxShadow='0 5px 15px rgba(71, 118, 230, 0.3)';"
|
| 525 |
+
onmouseout="this.style.transform='translateY(0)'; this.style.boxShadow='none';"
|
| 526 |
+
onclick="event.preventDefault(); fetch(this.href).then(resp => resp.blob()).then(blob => {{
|
| 527 |
+
const url = window.URL.createObjectURL(blob);
|
| 528 |
+
const a = document.createElement('a');
|
| 529 |
+
a.style.display = 'none';
|
| 530 |
+
a.href = url;
|
| 531 |
+
a.download = '{Path(tmp_path).name}';
|
| 532 |
+
document.body.appendChild(a);
|
| 533 |
+
a.click();
|
| 534 |
+
window.URL.revokeObjectURL(url);
|
| 535 |
+
document.body.removeChild(a);
|
| 536 |
+
}});">
|
| 537 |
+
Download Audio File
|
| 538 |
+
</a>
|
| 539 |
"""
|
| 540 |
|
| 541 |
return text, tmp_path, download_html
|