- 📄 Paste text or upload files (PDF, DOCX, TXT)
- 🔍 Choose summary length: short, medium, or long
- 🔐 Use your own OpenAI API key (optional)
- 📊 See token usage and estimated cost
- 💡 Clean UI built with Streamlit
- ☁️ Deployable on Streamlit Cloud
git clone https://github.com/abhimattx/SummarizerOpenAI.git
cd SummarizerOpenAICreate .streamlit/secrets.toml and paste:
OPENAI_API_KEY = "sk-xxxxxxxxxxxxxxxx"pip install -r requirements.txtstreamlit run app.py- Push this repo to GitHub
- Go to streamlit.io/cloud
- Connect your GitHub repo → Choose
app.py - In “Secrets”, add:
OPENAI_API_KEY = "sk-xxxxxxxxxxxxxxxx"Done! ✅
📁 Folder Structure
SummarizerOpenAI/
├── app.py # Streamlit UI
├── openai_api.py # GPT summarizer logic
├── file_handler.py # File upload reading logic
├── requirements.txt
├── .gitignore
├── README.md
├── .streamlit/
│ └── secrets.toml.example
└── assets/
📦 Requirements
streamlit
openai>=1.0.0
PyMuPDF # For PDFs
python-docx # For .docx files
tiktoken # For token counting
pillow # For image handling
The app shows token usage and approximate cost:
- GPT-3.5-turbo = ~$0.0015 per 1K tokens
- Calculation is shown under each summary
MIT – use it, remix it, build something great!