Spaces:
Build error
Build error
Update app.py
Browse files75 unmodified lines76777879808182232 unmodified lines3153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923 unmodified lines39639739839940040140210 unmodified lines4134144154164174184194204214224234244254264274284294304314324334344 unmodified lines43944044144244344444544620 unmodified lines46746846947047147275 unmodified lineselif "403" in error_msg:st.error("❌ API key doesn't have permission to access Groq API")else:st.error(f"❌ Failed to initialize Groq client: {error_msg}")return None# Define custom exception for Groq API errors232 unmodified lines# Enhanced structure for better organizationstructure = {"Executive Summary": "","Key Insights": "","Action Items": "","Questions & Considerations": "","Detailed Analysis": {"Context & Background": "","Main Discussion Points": "","Supporting Evidence": "","Conclusions & Recommendations": ""}}prompt = f"""You are an expert note organizer with exceptional skills in creating structured, clear, and comprehensive notes.Please analyze the following transcript and transform it into highly organized notes:```{transcript}```Create a well-structured document with the following sections:# Executive Summary- Provide a concise 3-5 sentence overview of the main topic and key takeaways- Use clear, direct language# Key Insights- Extract 5-7 critical insights as bullet points- Each insight should be bolded and followed by 1-2 supporting sentences- Organize these insights in order of importance# Action Items- Create a table with these columns: Action | Owner/Responsible Party | Timeline | Priority- List all tasks, assignments, or follow-up items mentioned- If information is not explicitly stated, indicate with "Not specified"# Questions & Considerations- List all questions raised during the discussion- Include concerns or areas needing further exploration- For each question, provide brief context explaining why it matters# Detailed Analysis## Context & Background- Summarize relevant background information- Explain the context in which the discussion took place- Include references to prior work or decisions if mentioned## Main Discussion Points- Create subsections for each major topic discussed- Use appropriate formatting (bullet points, numbered lists) to organize information- Include direct quotes when particularly significant, marked with ">"## Supporting Evidence- Create a table summarizing any data, evidence, or examples mentioned- Include source information when available## Conclusions & Recommendations- Summarize the conclusions reached- List any recommendations or next steps discussed- Note any decisions that were madeMake extensive use of markdown formatting:- Use tables for structured information- Use bold for emphasis on important points- Use bullet points and numbered lists for clarity- Use headings and subheadings to organize content- Include blockquotes for direct citationsYour notes should be comprehensive but concise, focusing on extracting the maximum value from the transcript."""try:3 unmodified linesresponse = st.session_state.groq_client.chat.completions.create(messages=[{"role": "user", "content": prompt}],model=LLM_MODEL,temperature=0.3, # Lower temperature for more structured outputmax_tokens=4096,top_p=0.95,stream=True10 unmodified linessection_markers = {"# Executive Summary": "Executive Summary","## Executive Summary": "Executive Summary","# Key Insights": "Key Insights","## Key Insights": "Key Insights","# Action Items": "Action Items","## Action Items": "Action Items","# Questions & Considerations": "Questions & Considerations","## Questions & Considerations": "Questions & Considerations","# Detailed Analysis": "Detailed Analysis","## Detailed Analysis": "Detailed Analysis","## Context & Background": "Context & Background","### Context & Background": "Context & Background","## Main Discussion Points": "Main Discussion Points","### Main Discussion Points": "Main Discussion Points","## Supporting Evidence": "Supporting Evidence","### Supporting Evidence": "Supporting Evidence","## Conclusions & Recommendations": "Conclusions & Recommendations","### Conclusions & Recommendations": "Conclusions & Recommendations"}for chunk in response:4 unmodified lines# Check for section markers in the accumulated contentfor marker, section in section_markers.items():if marker in notes_content:if section in ["Context & Background", "Main Discussion Points","Supporting Evidence", "Conclusions & Recommendations"]:current_section = "Detailed Analysis"current_subsection = sectionelse:20 unmodified linesst.error(f"Error processing transcript: {e}")return Nonedef export_notes(notes, format="markdown"):"""Export notes in the specified format"""if format == "markdown":75 unmodified lines7677787980818283232 unmodified lines3163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943 unmodified lines39839940040140240340410 unmodified lines4154164174184194204214224234244254264274284294304314324334344354364 unmodified lines44144244344444544644720 unmodified lines46846947047147247347475 unmodified lineselif "403" in error_msg:st.error("❌ API key doesn't have permission to access Groq API")else:st.error(f"❌ Failed to initialize Groq client: {error_msg}")return None# Define custom exception for Groq API errors232 unmodified lines# Enhanced structure for better organizationstructure = {"Executive Summary": "","Main Agenda": "","Points Discussed": "","Key Insights": "","Questions & Considerations": "","Detailed Analysis": {"Context & Background": "","Supporting Evidence": "",},"Next Steps": ""}prompt = f"""You are an expert meeting notes organizer with exceptional skills in creating structured, clear, and comprehensive notes.Please analyze the following transcript and transform it into highly organized meeting notes:```{transcript}```Create a professional meeting notes document with the following specific sections:# Executive Summary- Provide a concise 3-5 sentence overview of the meeting purpose and key outcomes- Use clear, direct language focused on the most important takeaways# Main Agenda- Extract and list the primary agenda items that were discussed in the meeting- Format as a numbered or bulleted list- Include time allocations or priority levels if mentioned in the transcript# Points Discussed- Provide a comprehensive breakdown of what was discussed for each agenda item- Use subheadings for each major topic- Include who raised specific points when identifiable- Organize chronologically as they appeared in the discussion# Key Insights- Extract 5-7 critical insights as bullet points- Each insight should be **bolded** and followed by 1-2 supporting sentences- Organize these insights in order of importance# Questions & Considerations- List all questions raised during the discussion- Include concerns or areas needing further exploration- For each question, provide brief context explaining why it matters# Detailed Analysis## Context & Background- Summarize relevant background information necessary to understand the discussion- Explain the context in which the meeting took place- Include references to prior meetings or decisions if mentioned## Supporting Evidence- Create a table summarizing any data, evidence, or examples mentioned- Include source information when available- Format data clearly using markdown tables when appropriate# Next Steps- Create a table with these columns: Action | Owner/Responsible Party | Timeline | Priority- List all tasks, assignments, follow-up items, and decisions made- If information is not explicitly stated, indicate with "Not specified"- Include any deadlines or important dates mentioned- This section should be comprehensive, capturing ALL action items from the meetingMake extensive use of markdown formatting:- Use tables for structured information- Use **bold** for emphasis on important points- Use bullet points and numbered lists for clarity- Use headings and subheadings to organize content- Include blockquotes for direct citations with > symbolYour notes should be professional, comprehensive yet concise, focusing on extracting the maximum value from the transcript."""try:3 unmodified linesresponse = st.session_state.groq_client.chat.completions.create(messages=[{"role": "user", "content": prompt}],model=LLM_MODEL,temperature=0.2, # Slightly lower temperature for more consistent structuremax_tokens=4096,top_p=0.95,stream=True10 unmodified linessection_markers = {"# Executive Summary": "Executive Summary","## Executive Summary": "Executive Summary","# Main Agenda": "Main Agenda","## Main Agenda": "Main Agenda","# Points Discussed": "Points Discussed","## Points Discussed": "Points Discussed","# Key Insights": "Key Insights","## Key Insights": "Key Insights","# Questions & Considerations": "Questions & Considerations","## Questions & Considerations": "Questions & Considerations","# Detailed Analysis": "Detailed Analysis","## Detailed Analysis": "Detailed Analysis","## Context & Background": "Context & Background","### Context & Background": "Context & Background","## Supporting Evidence": "Supporting Evidence","### Supporting Evidence": "Supporting Evidence","# Next Steps": "Next Steps","## Next Steps": "Next Steps"}for chunk in response:4 unmodified lines# Check for section markers in the accumulated contentfor marker, section in section_markers.items():if marker in notes_content:if section in ["Context & Background", "Supporting Evidence"]:current_section = "Detailed Analysis"current_subsection = sectionelse:20 unmodified linesst.error(f"Error processing transcript: {e}")return Nonedef export_notes(notes, format="markdown"):"""Export notes in the specified format"""if format == "markdown":
app.py+49-47