File size: 2,369 Bytes
5f35544
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr, os, json
from nlp_utils import transcribe_audio, summarize, extract_actions_decisions, make_minutes_md

OUT_DIR = "outputs"
os.makedirs(OUT_DIR, exist_ok=True)

def process(audio_file, transcript_text, meeting_title):
    text = ""
    if audio_file is not None:
        text = transcribe_audio(audio_file)
    if transcript_text and transcript_text.strip():
        extra = transcript_text.strip()
        text = (text + "\n" + extra).strip() if text else extra

    if not text or len(text) < 40:
        return "Please upload audio OR paste a transcript (≥ 40 characters).", "", [], [], None

    resum = summarize(text)
    ed = extract_actions_decisions(text)
    actions = ed.get("actions", [])
    decisions = ed.get("decisions", [])

    title = meeting_title or "Meeting"
    md = make_minutes_md(title, resum, actions, decisions)
    md_path = os.path.join(OUT_DIR, "minutes.md")
    with open(md_path, "w", encoding="utf-8") as f:
        f.write(md)

    actions_ht = [(a, "Action") for a in actions] if actions else []
    decisions_ht = [(d, "Decision") for d in decisions] if decisions else []

    return "Done ✅", resum, actions_ht, decisions_ht, md_path

with gr.Blocks(title="MeetingNotes AI — Meeting Summarizer") as demo:
    gr.Markdown("# MeetingNotes AI — Meeting Summarizer")
    gr.Markdown("Upload **audio** or **paste a transcript**, then click **Analyze**. Multilingual audio supported (EN/FR).")

    with gr.Row():
        with gr.Column():
            meeting_title = gr.Textbox(label="Meeting Title", value="Product Launch — Weekly")
            audio = gr.Audio(label="Audio (mp3/wav)", sources=["upload"], type="filepath")
            transcript = gr.Textbox(label="Transcript (optional if audio)", lines=10, placeholder="Paste here…")
            btn = gr.Button("Analyze")
        with gr.Column():
            status = gr.Textbox(label="Status")
            resume = gr.Textbox(label="Summary", lines=8)
            actions = gr.HighlightedText(label="Action Items", combine_adjacent=True)
            decisions = gr.HighlightedText(label="Decisions", combine_adjacent=True)
            files = gr.File(label="Download minutes.md")

    btn.click(process, inputs=[audio, transcript, meeting_title], outputs=[status, resume, actions, decisions, files])

if __name__ == "__main__":
    demo.launch()