Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# File: main.py (Enhanced Entry Point)
|
2 |
+
import time
|
3 |
+
import threading
|
4 |
+
import queue
|
5 |
+
from audio_capture import AudioRecorder
|
6 |
+
from transcriber import WhisperTranscriber
|
7 |
+
from analyzer import MeetingAnalyzer
|
8 |
+
from integrations import Notifier
|
9 |
+
import config
|
10 |
+
|
11 |
+
class MeetingProcessor:
|
12 |
+
def __init__(self):
|
13 |
+
self.recorder = AudioRecorder()
|
14 |
+
self.transcriber = WhisperTranscriber()
|
15 |
+
self.analyzer = MeetingAnalyzer()
|
16 |
+
self.notifier = Notifier()
|
17 |
+
self.transcript_queue = queue.Queue()
|
18 |
+
self.running = True
|
19 |
+
|
20 |
+
# Start processing threads
|
21 |
+
threading.Thread(target=self._transcription_worker, daemon=True).start()
|
22 |
+
threading.Thread(target=self._analysis_worker, daemon=True).start()
|
23 |
+
|
24 |
+
def _transcription_worker(self):
|
25 |
+
while self.running:
|
26 |
+
audio_chunk = self.recorder.get_audio_chunk()
|
27 |
+
if audio_chunk:
|
28 |
+
try:
|
29 |
+
transcript = self.transcriber.transcribe(audio_chunk)
|
30 |
+
if transcript:
|
31 |
+
self.transcript_queue.put(transcript)
|
32 |
+
except Exception as e:
|
33 |
+
print(f"Transcription error: {str(e)}")
|
34 |
+
time.sleep(0.1)
|
35 |
+
|
36 |
+
def _analysis_worker(self):
|
37 |
+
while self.running:
|
38 |
+
try:
|
39 |
+
transcript = self.transcript_queue.get(timeout=1.0)
|
40 |
+
self.analyzer.process_chunk(transcript)
|
41 |
+
# Real-time action item detection
|
42 |
+
urgent_items = self.analyzer.detect_urgent_action_items()
|
43 |
+
if urgent_items:
|
44 |
+
print("\n🚨 URGENT ACTION ITEM DETECTED!")
|
45 |
+
for item in urgent_items:
|
46 |
+
print(f"• {item['task']} (Owner: {item['owner']}, Deadline: {item['deadline']})")
|
47 |
+
self.notifier.send_urgent_alert(urgent_items)
|
48 |
+
except queue.Empty:
|
49 |
+
continue
|
50 |
+
|
51 |
+
def start(self):
|
52 |
+
print("🎤 Starting meeting processing... Press Ctrl+C to end meeting")
|
53 |
+
self.recorder.start_recording()
|
54 |
+
|
55 |
+
try:
|
56 |
+
# Keep main thread alive
|
57 |
+
while True:
|
58 |
+
time.sleep(1)
|
59 |
+
except KeyboardInterrupt:
|
60 |
+
print("\n⏹️ Meeting ended. Generating final report...")
|
61 |
+
self.running = False
|
62 |
+
self._finalize_processing()
|
63 |
+
|
64 |
+
def _finalize_processing(self):
|
65 |
+
# Process remaining audio
|
66 |
+
final_audio = self.recorder.stop_recording()
|
67 |
+
if final_audio:
|
68 |
+
final_transcript = self.transcriber.transcribe_final(final_audio)
|
69 |
+
if final_transcript:
|
70 |
+
self.analyzer.process_chunk(final_transcript)
|
71 |
+
|
72 |
+
# Generate AI analysis
|
73 |
+
full_transcript = self.analyzer.get_full_transcript()
|
74 |
+
summary = self.analyzer.generate_summary()
|
75 |
+
action_items = self.analyzer.extract_action_items()
|
76 |
+
decisions = self.analyzer.extract_decisions()
|
77 |
+
|
78 |
+
# Display results
|
79 |
+
print("\n📝 Final Meeting Summary:")
|
80 |
+
print(summary)
|
81 |
+
print("\n✅ Action Items:")
|
82 |
+
for i, item in enumerate(action_items, 1):
|
83 |
+
print(f"{i}. {item['task']} (Owner: {item['owner']}, Deadline: {item['deadline']})")
|
84 |
+
|
85 |
+
# Send comprehensive report
|
86 |
+
self.notifier.send_comprehensive_report(
|
87 |
+
summary=summary,
|
88 |
+
action_items=action_items,
|
89 |
+
decisions=decisions,
|
90 |
+
transcript=full_transcript,
|
91 |
+
recipients=config.NOTIFICATION_RECIPIENTS
|
92 |
+
)
|
93 |
+
|
94 |
+
print("\n🚀 Comprehensive report sent to all recipients!")
|
95 |
+
|
96 |
+
if __name__ == "__main__":
|
97 |
+
processor = MeetingProcessor()
|
98 |
+
processor.start()
|