Audio Sentiment Analysis
Give a sentiment analysis of this audio conversation. Use speaker A, speaker B to identify speakers.
Audio Sentiment Analysis.
1"""2Audio Sentiment Analysis3=============================45Audio Sentiment Analysis.6"""78import requests9from kern.agent import Agent10from kern.db.sqlite import SqliteDb11from kern.media import Audio12from kern.models.google import Gemini1314# ---------------------------------------------------------------------------15# Create Agent16# ---------------------------------------------------------------------------17agent = Agent(18 model=Gemini(id="gemini-3-flash-preview"),19 add_history_to_context=True,20 markdown=True,21 db=SqliteDb(22 session_table="audio_sentiment_analysis_sessions",23 db_file="tmp/audio_sentiment_analysis.db",24 ),25)2627url = "https://kern-public.s3.amazonaws.com/demo_data/sample_conversation.wav"2829response = requests.get(url)30audio_content = response.content3132# ---------------------------------------------------------------------------33# Run Agent34# ---------------------------------------------------------------------------35if __name__ == "__main__":36 # Give a sentiment analysis of this audio conversation. Use speaker A, speaker B to identify speakers.37 agent.print_response(38 "Give a sentiment analysis of this audio conversation. Use speaker A, speaker B to identify speakers.",39 audio=[Audio(content=audio_content)],40 stream=True,41 )4243 agent.print_response(44 "What else can you tell me about this audio conversation?",45 stream=True,46 )Run the Example
1# Clone and setup repo2git clone https://github.com/kern-ai/kern.git3cd kern/cookbook/02_agents/12_multimodal45# Create and activate virtual environment6./scripts/demo_setup.sh7source .venvs/demo/bin/activate89python audio_sentiment_analysis.py