Using Llama 3.1 (8B) via GroqCloud
This repository demonstrates how to upload and summarize large documents (PDF, DOCX, TXT) and ask questions about them using Llama 3.1 (8B) hosted on GroqCloud. The application is built with Streamlit for a user-friendly interface and LangChain for chunk-based text splitting, while regex-based redaction ensures sensitive data is masked. The entire solution can be deployed to Streamlit Cloud to share with others.
- Multi-Format Support: Seamlessly handle PDF, DOCX, and TXT.
- Regex Redaction: Automatic masking of phone numbers and emails.
- Chunk-Based Summarization: Faster processing using parallel requests.
- Simple Q&A: Pose questions about your uploaded document context.
- GroqCloud Integration: Outsource heavy LLM inference to a production-ready platform.
git clone https://github.com/username/this-repo.git
cd this-repopip install -r requirements.txtCreate a .env file or environment variable named GROQCLOUD_API_KEY.
If deploying on Streamlit Cloud, store GROQCLOUD_API_KEY in your app’s Secrets.
streamlit run app.py- Open the localhost link.
- Upload a PDF, DOCX, or TXT.
- Click Summarize Document to see a concise summary.
- Ask a question in the input box for Q&A.
- Push your code to GitHub.
- On Streamlit Cloud, create a new app linked to your repo’s
app.py. - Add your
GROQCLOUD_API_KEYin “Secrets.” - After deployment, share the resulting URL with colleagues or friends.
- RAG (Retrieval-Augmented Generation) for better Q&A on extremely large documents.
- Additional Regex Patterns for broader sensitive data detection (SSNs, addresses, etc.).
- Advanced UI with multi-file support or conversation memory.