Spaces:
Sleeping
Sleeping
File size: 4,714 Bytes
5da9a16 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
import gradio as gr
import torch
from utils.speech_processor import SpeechProcessor
from utils.text_processor import TextProcessor
from utils.output_generator import OutputGenerator
import tempfile
import os
# Initialize processors
speech_processor = SpeechProcessor()
text_processor = TextProcessor()
output_generator = OutputGenerator()
def process_meeting(audio_file, language="id", summary_ratio=0.3):
"""
Main pipeline untuk memproses audio meeting
"""
try:
# Step 1: Speech Processing
gr.Info("π€ Memproses audio...")
transcript_with_speakers = speech_processor.process_audio(
audio_file,
language=language
)
# Step 2: Text Processing & Summarization
gr.Info("π Membuat ringkasan...")
summary = text_processor.summarize_transcript(
transcript_with_speakers,
ratio=summary_ratio
)
# Step 3: Information Extraction
gr.Info("π Mengekstrak informasi penting...")
extracted_info = text_processor.extract_key_information(
transcript_with_speakers
)
# Step 4: Generate Output
gr.Info("π Membuat notulensi...")
outputs = output_generator.generate_all_formats(
transcript_with_speakers,
summary,
extracted_info
)
return (
outputs['markdown'],
outputs['json'],
outputs['transcript_table'],
outputs['action_items_table'],
outputs['decisions_table']
)
except Exception as e:
gr.Error(f"Error: {str(e)}")
return None, None, None, None, None
# Gradio Interface
with gr.Blocks(title="π€ AI Meeting Minutes Generator") as demo:
gr.Markdown("""
# π€ AI Meeting Minutes Generator
Upload audio rapat Anda dan dapatkan notulensi otomatis dengan:
- π― Identifikasi pembicara
- π Ringkasan otomatis
- β
Action items
- π Keputusan penting
""")
with gr.Row():
with gr.Column():
audio_input = gr.Audio(
label="Upload Audio Rapat",
type="filepath",
sources=["upload", "microphone"]
)
with gr.Row():
language = gr.Dropdown(
choices=[
("Indonesia", "id"),
("English", "en")
],
value="id",
label="Bahasa"
)
summary_ratio = gr.Slider(
minimum=0.1,
maximum=0.5,
value=0.3,
step=0.05,
label="Rasio Ringkasan"
)
process_btn = gr.Button("π Proses Audio", variant="primary")
with gr.Row():
with gr.Column():
gr.Markdown("### π Notulensi (Markdown)")
markdown_output = gr.Textbox(
label="Preview Notulensi",
lines=20,
max_lines=30
)
json_download = gr.File(
label="π₯ Download JSON"
)
with gr.Row():
with gr.Column():
gr.Markdown("### π Transkrip Lengkap")
transcript_table = gr.Dataframe(
headers=["Waktu", "Pembicara", "Teks"],
label="Transkrip dengan Pembicara"
)
with gr.Row():
with gr.Column():
gr.Markdown("### β
Action Items")
action_items_table = gr.Dataframe(
headers=["Action Item", "Penanggung Jawab", "Timestamp"],
label="Daftar Action Items"
)
with gr.Column():
gr.Markdown("### π Keputusan")
decisions_table = gr.Dataframe(
headers=["Keputusan", "Pembicara", "Timestamp"],
label="Daftar Keputusan"
)
# Process button action
process_btn.click(
fn=process_meeting,
inputs=[audio_input, language, summary_ratio],
outputs=[
markdown_output,
json_download,
transcript_table,
action_items_table,
decisions_table
]
)
# Examples
gr.Examples(
examples=[
["examples/meeting_sample_id.wav", "id", 0.3],
["examples/meeting_sample_en.wav", "en", 0.25]
],
inputs=[audio_input, language, summary_ratio]
)
if __name__ == "__main__":
demo.launch() |