Spaces:
Sleeping
Download README.md from mingnatthakitt/ScratchLM: direct link, hf CLI and curl.
- Browser
- Download file 5.28 kB
-
https://huggingface.co/spaces/mingnatthakitt/ScratchLM/resolve/main/README.md
- Command line
-
hf download hf://spaces/mingnatthakitt/ScratchLM/README.md
-
curl -L -o README.md https://huggingface.co/spaces/mingnatthakitt/ScratchLM/resolve/main/README.md
title: ScratchLM
emoji: ๐
colorFrom: purple
colorTo: blue
sdk: docker
app_port: 7860
pinned: false
ScratchLM
Zero-DB AI Study Assistant - Upload PDFs, extract content, and get AI-powered cheatsheets and interactive tutoring.
โจ Key Features
๐ Local PDF Processing
- Drag & Drop Upload: Upload multiple PDFs directly in your browser
- Local Extraction: Text extraction happens entirely on the server
- Multi-Document Support: Process multiple PDFs simultaneously with clear demarcation
๐ AI-Powered Cheatsheet Generator
- 4-Zone Structure: Automatically generates comprehensive study guides:
- Zone A: Concept Deep-Dive
- Zone B: Real-World Analogies
- Zone C: Worked Problems
- Zone D: Exam Traps & Strategy
- Markdown Export: Download cheatsheets as
.mdfiles for Obsidian, Notion, or any็ฌ่ฎฐ app
๐ฌ RAG Chat with Full Context
- Document-Aware: Chat remembers everything from your uploaded PDFs
- Conversation History: Multi-turn dialogues with context retention
- Step-by-Step Teaching: AI tutor explains concepts rather than just answering
๐ Privacy First
- Zero Database: No user data stored anywhere
- Session Isolation: Each browser tab is isolated
- One-Click Wipe: Refresh the page to clear all data
๐ AI Architecture
Model: Gemma 4 31B IT
The app uses Gemma 4 31B Instruction-Tuned model via Google AI Studio API for:
- Complex reasoning and explanation generation
- Multi-step problem solving
- Conceptual teaching with analogies
PDF Processing: pypdf
- Pure Python PDF text extraction
- No external services or cloud dependencies
- Preserves document structure and page breaks
๐ ๏ธ Technical Stack
| Component | Technology |
|---|---|
| Web Framework | FastAPI |
| Frontend | Vanilla HTML/CSS/JS |
| AI Model | Gemma 4 31B IT |
| PDF Parsing | pypdf |
| Markdown Rendering | marked.js |
๐ Getting Started
Prerequisites
- A Google AI Studio API key (free tier available)
- Docker (for local development)
Local Setup
Clone the repository:
git clone https://huggingface.co/spaces/mingnatthakitt/ScratchLMSet up environment variable:
export GEMINI_API_KEY="your_api_key_here"Run with Docker:
docker build -t scratchlm . docker run -p 7860:7860 -e GEMINI_API_KEY=$GEMINI_API_KEY scratchlmOr run without Docker:
pip install -r requirements.txt python app.pyOpen in browser: Navigate to
http://localhost:7860
Hugging Face Spaces
- Fork the Space: Clone it to your account
- Add Secrets: Go to Space Settings โ Repository secrets โ Add
GEMINI_API_KEY - Done: The Space will automatically build and run
๐ How to Use
Step 1: Upload PDFs
Drag and drop PDF files onto the upload area, or click to browse.
Step 2: Extract Text
Click โก Extract to process your documents. The extracted text will appear in the preview panel.
Step 3: Generate Cheatsheet
Click โจ Generate to create a comprehensive 4-zone study guide from your documents.
Step 4: Download or Chat
- ๐ฅ Download .md: Save the cheatsheet as a Markdown file
- ๐ฌ Chat: Ask questions about your documents with full context awareness
โ๏ธ License
GNU Affero General Public License v3.0 (AGPL-3.0)
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/agpl-3.0.en.html.
๐ Acknowledgments
- Google AI for providing Gemma models via AI Studio
- Hugging Face for the Spaces infrastructure
- FastAPI for the excellent web framework