--- license: mit title: LangChain-VideoWeb-Summarizer sdk: streamlit emoji: 👀 colorFrom: yellow colorTo: blue sdk_version: 1.45.1 --- # AI Content Summarizer This Streamlit application leverages AI to summarize web articles and YouTube videos. Users can input a URL, and the app will provide a concise summary of the content. It summarizes YouTube videos or any website content using **LangChain**, **Google's Gemini API**, and **LangChain's document loaders**. It uses `LangChain` and `ChatGoogleGenerativeAI` with `gemini-1.5-flash` model. ## Features - **Web Article Summarization**: Enter the URL of any online article to get a summary. - **YouTube Video Summarization**: Provide a YouTube video URL to receive a transcript summary. - **Secure API Key Handling**: Uses Streamlit's sidebar for API key input, ensuring it's not exposed in the main interface. - **User-Friendly Interface**: Simple and intuitive design for ease of use. ## Technologies Used - **Streamlit**: For creating the web application interface. - **Langchain**: To handle the summarization chain and document processing. - **Langchain**: To handle the summarization chain and document processing. - **[LangChain Google GenAI](https://python.langchain.com/docs/integrations/llms/google_generative_ai)** – for LLM integration. - **Validators**: To ensure the validity of input URLs. - **youtube_transcript_api**: For fetching transcripts from YouTube videos. - **pytube**: To extract video information from YouTube. - **Unstructured**: For parsing and extracting content from HTML (web articles). ## Setup and Installation 1. **Clone the repository:** ```bash git clone https://github.com/your-username/ai-content-summarizer.git cd ai-content-summarizer ``` 2. **Create a virtual environment and activate it:** ```bash python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate` ``` 3. **Install the required dependencies:** ```bash pip install -r requirements.txt ``` 4. **Set your Google API Key:** - Obtain an API key from [Google AI Studio](https://aistudio.google.com/app/apikey). - You can set it as an environment variable: ```bash export GOOGLE_API_KEY='your_google_api_key_here' ``` - Alternatively, you can enter it directly in the application's sidebar when prompted. ## How to Run 1. **Ensure your virtual environment is activated and dependencies are installed.** 2. **Run the Streamlit application:** ```bash streamlit run app.py ``` 3. Open your web browser and navigate to the local URL provided by Streamlit (usually `http://localhost:8501`). 4. Enter your **Google API Key** in the sidebar. 5. Paste the URL of a web article or YouTube video into the input field and click "Summarize". ## Example Usage 1. **Find an interesting article online or a YouTube video.** 2. **Copy its URL.** 3. **Paste the URL into the app's input field.** 4. **Click "Summarize" and wait for the AI to generate the summary.** ## Contributing Contributions are welcome! If you have suggestions for improvements or new features, please feel free to: 1. Fork the repository. 2. Create a new branch (`git checkout -b feature/your-feature-name`). 3. Make your changes. 4. Commit your changes (`git commit -m 'Add some feature'`). 5. Push to the branch (`git push origin feature/your-feature-name`). 6. Open a Pull Request. ## License This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details (if you add one). ## Notes - You must have a **valid Google API Key** to use this app. - The quality of the summary depends on the clarity and structure of the source content.