import streamlit as st from dotenv import load_dotenv load_dotenv() ##load all the evironment variables import os import google.generativeai as genai from youtube_transcript_api import YouTubeTranscriptApi genai.configure(api_key=os.getenv("GOOGLE_API_KEY")) prompt=""" You are an expert AI assistant specializing in transcribing and taking detailed notes from transcript related to Machine Learning, Deep Learning, and Artificial Intelligence. Your task is to provide a comprehensive summary of the following transcript, including all key points, discussions, and Q&A sessions. Please follow these guidelines: 1. Main Content: - Identify and summarize the main topic(s) discussed in the transcript. - List all key concepts, theories, and techniques mentioned. - Provide detailed explanations for each concept, including definitions, applications, and significance in the field. - Note any examples or case studies presented to illustrate concepts. - Capture any formulas, algorithms, or code snippets discussed, ensuring they are accurately transcribed. - Highlight any cutting-edge research or recent advancements mentioned. Please provide the summary of the text given here: """ ## getting the transcript data from yt videos def extract_transcript_details(youtube_video_url): try: video_id=youtube_video_url.split("=")[1] transcript_text=YouTubeTranscriptApi.get_transcript(video_id) transcript = "" for i in transcript_text: transcript += " " + i["text"] return transcript except Exception as e: raise e ## getting the summary based on Prompt from Google Gemini Pro def generate_gemini_content(transcript_text,prompt): model=genai.GenerativeModel("gemini-pro") response=model.generate_content(prompt+transcript_text) return response.text st.title("🎥DDS YouTube Note Generator") youtube_link = st.text_input("Enter YouTube Video Link:") if youtube_link: video_id = youtube_link.split("=")[1] print(video_id) st.image(f"http://img.youtube.com/vi/{video_id}/0.jpg", use_column_width=True) if st.button("Get Detailed Notes"): transcript_text=extract_transcript_details(youtube_link) if transcript_text: summary=generate_gemini_content(transcript_text,prompt) st.markdown("## Detailed Notes are below:") st.write(summary)