Spaces:
Running on Zero
Running on Zero
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -631,6 +631,75 @@ footer { display: none !important; }
|
|
| 631 |
border-color: #6366f1 !important;
|
| 632 |
}
|
| 633 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 634 |
/* Footer */
|
| 635 |
.footer-text {
|
| 636 |
text-align: center;
|
|
@@ -642,6 +711,13 @@ footer { display: none !important; }
|
|
| 642 |
color: #818cf8;
|
| 643 |
text-decoration: none;
|
| 644 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 645 |
"""
|
| 646 |
|
| 647 |
with gr.Blocks(theme=THEME, title="TranscribeAI", css=CUSTOM_CSS) as demo:
|
|
@@ -650,43 +726,59 @@ with gr.Blocks(theme=THEME, title="TranscribeAI", css=CUSTOM_CSS) as demo:
|
|
| 650 |
gr.HTML("""
|
| 651 |
<div class="header-wrap">
|
| 652 |
<h1>TranscribeAI</h1>
|
| 653 |
-
<p>Transkripsi Audio dengan Speaker Diarization</p>
|
| 654 |
<div class="badge-gpu">ZeroGPU H200 • Whisper • Tanpa API Key</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 655 |
</div>
|
| 656 |
""")
|
| 657 |
|
| 658 |
-
# ---- Upload
|
| 659 |
with gr.Group(elem_classes="card-section"):
|
| 660 |
-
gr.HTML('<div class="card-title">🎵 Upload
|
| 661 |
-
|
| 662 |
-
|
| 663 |
-
|
| 664 |
-
|
| 665 |
-
|
| 666 |
-
|
| 667 |
-
|
| 668 |
-
|
| 669 |
-
|
| 670 |
-
model_choice = gr.Dropdown(
|
| 671 |
-
choices=list(WHISPER_MODELS.keys()),
|
| 672 |
-
value="small",
|
| 673 |
-
label="Model Whisper",
|
| 674 |
-
info="tiny (cepat) → large-v3 (akurat)"
|
| 675 |
-
)
|
| 676 |
-
language_choice = gr.Dropdown(
|
| 677 |
-
choices=list(LANGUAGE_MAP.keys()),
|
| 678 |
-
value="Auto-detect",
|
| 679 |
-
label="Bahasa",
|
| 680 |
-
)
|
| 681 |
-
speaker_count = gr.Slider(
|
| 682 |
-
minimum=0, maximum=10, step=1, value=0,
|
| 683 |
-
label="Jumlah Pembicara",
|
| 684 |
-
info="0 = auto-detect"
|
| 685 |
-
)
|
| 686 |
-
|
| 687 |
-
# ---- Options ----
|
| 688 |
with gr.Group(elem_classes="card-section"):
|
| 689 |
-
gr.HTML('<div class="card-title">⚙️
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 690 |
with gr.Row(elem_classes="toggle-row"):
|
| 691 |
enable_diarization = gr.Checkbox(
|
| 692 |
value=True,
|
|
@@ -696,7 +788,7 @@ with gr.Blocks(theme=THEME, title="TranscribeAI", css=CUSTOM_CSS) as demo:
|
|
| 696 |
enable_vad = gr.Checkbox(
|
| 697 |
value=True,
|
| 698 |
label="VAD Filter",
|
| 699 |
-
info="Lewati bagian hening"
|
| 700 |
)
|
| 701 |
|
| 702 |
# ---- Start Button ----
|
|
@@ -708,29 +800,30 @@ with gr.Blocks(theme=THEME, title="TranscribeAI", css=CUSTOM_CSS) as demo:
|
|
| 708 |
)
|
| 709 |
|
| 710 |
# ---- Results ----
|
| 711 |
-
with gr.Group(elem_classes="card-section"
|
| 712 |
-
gr.HTML('<div class="card-title">📊 Hasil</div>')
|
| 713 |
summary_output = gr.Markdown(
|
| 714 |
-
label="Ringkasan",
|
| 715 |
elem_classes="summary-box",
|
|
|
|
| 716 |
)
|
| 717 |
transcript_output = gr.Textbox(
|
| 718 |
-
label="Transkripsi",
|
| 719 |
-
lines=
|
| 720 |
-
max_lines=
|
| 721 |
show_copy_button=True,
|
| 722 |
interactive=False,
|
| 723 |
elem_classes="transcript-box",
|
| 724 |
-
placeholder="Hasil transkripsi akan muncul di sini...",
|
| 725 |
)
|
| 726 |
|
| 727 |
# ---- Downloads ----
|
| 728 |
with gr.Group(elem_classes="card-section"):
|
| 729 |
-
gr.HTML('<div class="card-title">📥 Download</div>')
|
|
|
|
| 730 |
with gr.Row(elem_classes="download-row"):
|
| 731 |
-
srt_file = gr.File(label="SRT
|
| 732 |
-
txt_file = gr.File(label="TXT
|
| 733 |
-
docx_file = gr.File(label="DOCX
|
| 734 |
|
| 735 |
# ---- Connect ----
|
| 736 |
btn_start.click(
|
|
|
|
| 631 |
border-color: #6366f1 !important;
|
| 632 |
}
|
| 633 |
|
| 634 |
+
/* Model info chips */
|
| 635 |
+
.model-chips {
|
| 636 |
+
display: flex;
|
| 637 |
+
gap: 6px;
|
| 638 |
+
flex-wrap: wrap;
|
| 639 |
+
margin-top: 8px;
|
| 640 |
+
}
|
| 641 |
+
.model-chip {
|
| 642 |
+
display: inline-flex;
|
| 643 |
+
align-items: center;
|
| 644 |
+
gap: 4px;
|
| 645 |
+
background: #222228;
|
| 646 |
+
color: #a0a0b0;
|
| 647 |
+
font-size: 11px;
|
| 648 |
+
padding: 3px 10px;
|
| 649 |
+
border-radius: 6px;
|
| 650 |
+
border: 1px solid #333340;
|
| 651 |
+
}
|
| 652 |
+
.model-chip.active {
|
| 653 |
+
background: rgba(99,102,241,.12);
|
| 654 |
+
color: #818cf8;
|
| 655 |
+
border-color: #6366f1;
|
| 656 |
+
}
|
| 657 |
+
|
| 658 |
+
/* How-to steps */
|
| 659 |
+
.howto {
|
| 660 |
+
display: flex;
|
| 661 |
+
gap: 16px;
|
| 662 |
+
margin: 12px 0 4px;
|
| 663 |
+
flex-wrap: wrap;
|
| 664 |
+
}
|
| 665 |
+
.howto-step {
|
| 666 |
+
display: flex;
|
| 667 |
+
align-items: center;
|
| 668 |
+
gap: 8px;
|
| 669 |
+
font-size: 13px;
|
| 670 |
+
color: #a0a0b0;
|
| 671 |
+
}
|
| 672 |
+
.howto-num {
|
| 673 |
+
width: 24px;
|
| 674 |
+
height: 24px;
|
| 675 |
+
border-radius: 50%;
|
| 676 |
+
background: linear-gradient(135deg, #6366f1, #8b5cf6);
|
| 677 |
+
color: #fff;
|
| 678 |
+
font-size: 12px;
|
| 679 |
+
font-weight: 700;
|
| 680 |
+
display: flex;
|
| 681 |
+
align-items: center;
|
| 682 |
+
justify-content: center;
|
| 683 |
+
flex-shrink: 0;
|
| 684 |
+
}
|
| 685 |
+
|
| 686 |
+
/* Feature tags */
|
| 687 |
+
.features {
|
| 688 |
+
display: flex;
|
| 689 |
+
gap: 8px;
|
| 690 |
+
flex-wrap: wrap;
|
| 691 |
+
justify-content: center;
|
| 692 |
+
margin-top: 12px;
|
| 693 |
+
}
|
| 694 |
+
.feat-tag {
|
| 695 |
+
font-size: 11px;
|
| 696 |
+
padding: 4px 10px;
|
| 697 |
+
border-radius: 6px;
|
| 698 |
+
background: #1a1a1f;
|
| 699 |
+
border: 1px solid #333340;
|
| 700 |
+
color: #a0a0b0;
|
| 701 |
+
}
|
| 702 |
+
|
| 703 |
/* Footer */
|
| 704 |
.footer-text {
|
| 705 |
text-align: center;
|
|
|
|
| 711 |
color: #818cf8;
|
| 712 |
text-decoration: none;
|
| 713 |
}
|
| 714 |
+
|
| 715 |
+
/* Responsive */
|
| 716 |
+
@media (max-width: 640px) {
|
| 717 |
+
.howto { flex-direction: column; gap: 8px; }
|
| 718 |
+
.features { gap: 4px; }
|
| 719 |
+
.header-wrap h1 { font-size: 26px !important; }
|
| 720 |
+
}
|
| 721 |
"""
|
| 722 |
|
| 723 |
with gr.Blocks(theme=THEME, title="TranscribeAI", css=CUSTOM_CSS) as demo:
|
|
|
|
| 726 |
gr.HTML("""
|
| 727 |
<div class="header-wrap">
|
| 728 |
<h1>TranscribeAI</h1>
|
| 729 |
+
<p>Transkripsi Audio dengan Speaker Diarization — Gratis & Cepat</p>
|
| 730 |
<div class="badge-gpu">ZeroGPU H200 • Whisper • Tanpa API Key</div>
|
| 731 |
+
<div class="features">
|
| 732 |
+
<span class="feat-tag">99+ Bahasa</span>
|
| 733 |
+
<span class="feat-tag">Speaker ID</span>
|
| 734 |
+
<span class="feat-tag">SRT / TXT / DOCX</span>
|
| 735 |
+
<span class="feat-tag">GPU Accelerated</span>
|
| 736 |
+
<span class="feat-tag">Auto-detect Bahasa</span>
|
| 737 |
+
</div>
|
| 738 |
+
<div class="howto">
|
| 739 |
+
<div class="howto-step"><div class="howto-num">1</div> Upload audio</div>
|
| 740 |
+
<div class="howto-step"><div class="howto-num">2</div> Pilih model & bahasa</div>
|
| 741 |
+
<div class="howto-step"><div class="howto-num">3</div> Klik Mulai</div>
|
| 742 |
+
<div class="howto-step"><div class="howto-num">4</div> Download hasil</div>
|
| 743 |
+
</div>
|
| 744 |
</div>
|
| 745 |
""")
|
| 746 |
|
| 747 |
+
# ---- Upload ----
|
| 748 |
with gr.Group(elem_classes="card-section"):
|
| 749 |
+
gr.HTML('<div class="card-title">🎵 Upload Audio</div>')
|
| 750 |
+
audio_input = gr.Audio(
|
| 751 |
+
label="Drag & drop file audio/video, atau klik untuk pilih file. Bisa juga rekam langsung.",
|
| 752 |
+
type="filepath",
|
| 753 |
+
sources=["upload", "microphone"],
|
| 754 |
+
elem_classes="audio-upload",
|
| 755 |
+
)
|
| 756 |
+
gr.HTML('<div style="font-size:11px;color:#6a6a7a;margin-top:6px;">Format: MP3, MP4, WAV, M4A, OGG, FLAC, WEBM • Maks ~1 jam audio</div>')
|
| 757 |
+
|
| 758 |
+
# ---- Settings ----
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 759 |
with gr.Group(elem_classes="card-section"):
|
| 760 |
+
gr.HTML('<div class="card-title">⚙️ Pengaturan</div>')
|
| 761 |
+
with gr.Row():
|
| 762 |
+
model_choice = gr.Dropdown(
|
| 763 |
+
choices=list(WHISPER_MODELS.keys()),
|
| 764 |
+
value="small",
|
| 765 |
+
label="Model Whisper",
|
| 766 |
+
info="tiny (39M, cepat) • base (74M) • small (244M, rekomendasi) • medium (769M) • large-v3 (1.5B, paling akurat)",
|
| 767 |
+
scale=2,
|
| 768 |
+
)
|
| 769 |
+
language_choice = gr.Dropdown(
|
| 770 |
+
choices=list(LANGUAGE_MAP.keys()),
|
| 771 |
+
value="Auto-detect",
|
| 772 |
+
label="Bahasa",
|
| 773 |
+
info="Auto-detect atau pilih bahasa spesifik",
|
| 774 |
+
scale=1,
|
| 775 |
+
)
|
| 776 |
+
speaker_count = gr.Slider(
|
| 777 |
+
minimum=0, maximum=10, step=1, value=0,
|
| 778 |
+
label="Jumlah Pembicara",
|
| 779 |
+
info="0 = auto-detect",
|
| 780 |
+
scale=1,
|
| 781 |
+
)
|
| 782 |
with gr.Row(elem_classes="toggle-row"):
|
| 783 |
enable_diarization = gr.Checkbox(
|
| 784 |
value=True,
|
|
|
|
| 788 |
enable_vad = gr.Checkbox(
|
| 789 |
value=True,
|
| 790 |
label="VAD Filter",
|
| 791 |
+
info="Lewati bagian hening untuk hasil lebih bersih"
|
| 792 |
)
|
| 793 |
|
| 794 |
# ---- Start Button ----
|
|
|
|
| 800 |
)
|
| 801 |
|
| 802 |
# ---- Results ----
|
| 803 |
+
with gr.Group(elem_classes="card-section"):
|
| 804 |
+
gr.HTML('<div class="card-title">📊 Hasil Transkripsi</div>')
|
| 805 |
summary_output = gr.Markdown(
|
|
|
|
| 806 |
elem_classes="summary-box",
|
| 807 |
+
value="*Upload audio dan klik 'Mulai Transkripsi' untuk memulai.*"
|
| 808 |
)
|
| 809 |
transcript_output = gr.Textbox(
|
| 810 |
+
label="Teks Transkripsi",
|
| 811 |
+
lines=20,
|
| 812 |
+
max_lines=50,
|
| 813 |
show_copy_button=True,
|
| 814 |
interactive=False,
|
| 815 |
elem_classes="transcript-box",
|
| 816 |
+
placeholder="Hasil transkripsi dengan timestamp dan speaker label akan muncul di sini...\n\n[00:00] Speaker 1: contoh teks transkripsi...",
|
| 817 |
)
|
| 818 |
|
| 819 |
# ---- Downloads ----
|
| 820 |
with gr.Group(elem_classes="card-section"):
|
| 821 |
+
gr.HTML('<div class="card-title">📥 Download File</div>')
|
| 822 |
+
gr.HTML('<div style="font-size:12px;color:#6a6a7a;margin-bottom:8px;">File otomatis dihapus setelah 1 jam.</div>')
|
| 823 |
with gr.Row(elem_classes="download-row"):
|
| 824 |
+
srt_file = gr.File(label="SRT — Subtitle untuk video player")
|
| 825 |
+
txt_file = gr.File(label="TXT — Teks dengan speaker label")
|
| 826 |
+
docx_file = gr.File(label="DOCX — Dokumen Word berwarna")
|
| 827 |
|
| 828 |
# ---- Connect ----
|
| 829 |
btn_start.click(
|