Spaces:
Sleeping
Sleeping
Lovish Singla
commited on
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
LangChain: Summarize Text from YouTube, Websites, or PDF
|
| 2 |
+
This Streamlit app allows you to summarize content from various sources like YouTube videos, websites, or uploaded PDF files. The app uses LangChain, Groq, and LangSmith to process and summarize content.
|
| 3 |
+
|
| 4 |
+
Features:
|
| 5 |
+
Summarize content from YouTube videos by providing a URL.
|
| 6 |
+
Summarize text from any website by providing its URL.
|
| 7 |
+
Summarize content from PDF files by uploading the file directly.
|
| 8 |
+
Integration with LangSmith for tracking and API key management.
|
| 9 |
+
Powered by Groq API for the language model, utilizing gemma2-9b-it for summarization.
|
| 10 |
+
Requirements:
|
| 11 |
+
Python 3.10
|
| 12 |
+
Streamlit: For creating the app interface.
|
| 13 |
+
LangChain: For managing language models and prompts.
|
| 14 |
+
LangChain_Groq: To interact with Groq language models.
|
| 15 |
+
LangChain_Community: For loading documents from various sources.
|
| 16 |
+
validators: To validate URL inputs.
|
| 17 |
+
Temporary files: For managing PDF uploads.
|
| 18 |
+
PyPDFLoader: To extract content from PDF files.
|
| 19 |
+
Installation:
|
| 20 |
+
Clone the repository:
|
| 21 |
+
|
| 22 |
+
bash
|
| 23 |
+
Copy code
|
| 24 |
+
git clone <repository_url>
|
| 25 |
+
Install dependencies: If you don't have the dependencies installed, you can install them using pip. It is recommended to use a virtual environment:
|
| 26 |
+
|
| 27 |
+
Copy code
|
| 28 |
+
pip install -r requirements.txt
|
| 29 |
+
Set up API Keys:
|
| 30 |
+
|
| 31 |
+
Groq API Key: You will need a Groq API Key to use the language model. You can obtain it from the Groq platform.
|
| 32 |
+
LangSmith API Key: You will also need a LangSmith API Key for tracking. You can get it from the LangSmith platform.
|
| 33 |
+
Configuration:
|
| 34 |
+
Set your API keys in the sidebar:
|
| 35 |
+
|
| 36 |
+
Groq API Key: Enter your Groq API key.
|
| 37 |
+
LangSmith API Key: Enter your LangSmith API key.
|
| 38 |
+
Provide either a YouTube URL or Website URL for summarization, or upload a PDF file.
|
| 39 |
+
|
| 40 |
+
Usage:
|
| 41 |
+
Summarize a YouTube Video:
|
| 42 |
+
|
| 43 |
+
Paste the YouTube video URL in the provided text input and click the "Summarize the Content" button. The app will load the video content and generate a summary.
|
| 44 |
+
Summarize a Website:
|
| 45 |
+
|
| 46 |
+
Paste any website URL (e.g., blog post, article) into the input field and click the "Summarize the Content" button. The app will load the page content and generate a summary.
|
| 47 |
+
Summarize a PDF:
|
| 48 |
+
|
| 49 |
+
Upload a PDF file using the file uploader and click the "Summarize the Content" button. The app will process the file and provide a summary.
|
| 50 |
+
View Summary:
|
| 51 |
+
|
| 52 |
+
After processing, the app will display the generated summary.
|
| 53 |
+
Example:
|
| 54 |
+
YouTube URL: https://www.youtube.com/watch?v=dQw4w9WgXcQ
|
| 55 |
+
Website URL: https://example.com/article
|
| 56 |
+
PDF Upload: Upload a file such as document.pdf
|
| 57 |
+
Troubleshooting:
|
| 58 |
+
Error: Missing API Keys:
|
| 59 |
+
|
| 60 |
+
Make sure you enter both the Groq API key and LangSmith API key in the sidebar.
|
| 61 |
+
Invalid URL:
|
| 62 |
+
|
| 63 |
+
Ensure that the URL entered is valid. The app only supports YouTube and website URLs.
|
| 64 |
+
Exception in Processing:
|
| 65 |
+
|
| 66 |
+
If an error occurs while processing the content, the app will display an exception message. Double-check your input and try again.
|
| 67 |
+
License:
|
| 68 |
+
This project is licensed under the MIT License - see the LICENSE file for details.
|