Textionary is a Streamlit-powered web application that lets you “chat” with any plain-text file. Simply upload a .txt document, ask questions in natural language, and see context-aware answers generated on the fly using Google’s Gemini LLM and LangChain.
👉 Live Demo: https://textionary.onrender.com/
- Features
- Tech Stack
- Project Structure
- Getting Started
- How It Works
- Usage
- Future Improvements
- License
- Streamlit UI: Intuitive chat interface with file uploader and message history.
- File Chunking: Splits large text into 1,000-character chunks for efficient retrieval.
- Vector Store: Persists embeddings in a Chroma DB under
db_store/chroma_db_romeo_juliet/. - Retrieval: Fetches top-3 most relevant chunks via semantic similarity.
- LLM Integration: Uses Google Gemini 2.0 (via
langchain_google_genai) for both embeddings and chat generation. - Typing Effect: Simulated “typing” animation in chat responses.
- Session State: Maintains full conversation history across interactions.
- Celebration: Streams balloons on each successful assistant response.
- Frontend / App Framework: Streamlit
- LLM & Embeddings: Google Generative AI (Gemini 2.0 Flash + embeddings-001)
- Orchestration: LangChain (document loaders, text splitters, prompt templates)
- Vector Database: Chroma (via
langchain_chroma) - Environment: Python 3.x,
.envfor secrets - Deployment: Render (https://textionary.onrender.com/)
.
├── Custom Chat.py # Streamlit app entrypoint
├── utils.py # Vector-store creation & retrieval functions
├── db_store/ # Persists Chroma embeddings
│ └── chroma_db_romeo_juliet/
├── requirements.txt # Python dependencies
├── .env.example # Example env vars (see below)
└── README.md # This file
- Python 3.8+
- A Google Cloud project with access to the Generative AI API (Gemini)
- Render account (if you want to redeploy)
git clone https://github.com/18YashDB10/Textionary.git
cd Textionary
python -m venv venv
source venv/bin/activate # macOS/Linux
venv\Scripts\activate # Windows
pip install -r requirements.txtCreate & Copy to .env and fill in your credentials:
GOOGLE_API_KEY=your_google_api_key_here
GOOGLE_API_PROJECT=your_google_project_idStreamlit will auto-load .env via python-dotenv.
streamlit run "Custom Chat.py"Then open http://localhost:8501 in your browser.
- Upload: User uploads a
.txtfile viast.file_uploader. - Persist: The file is saved to a temporary path.
- Embed & Store:
utils.create_vector_store(tmp_file_path)- Loads text with
TextLoader - Splits into 1,000-character chunks (
CharacterTextSplitter) - Embeds via
GoogleGenerativeAIEmbeddings - Persists in a Chroma DB folder.
- Retrieve:
- On each query,
utils.get_similar_docs(query)loads the same DB, retrieves the top 3 chunks.
- On each query,
- Prompting:
- The app wraps retrieved chunks and user question into a prompt via
ChatPromptTemplate.
- The app wraps retrieved chunks and user question into a prompt via
- Generate:
- Sends prompt to Gemini 2.0 Flash (
ChatGoogleGenerativeAI), returns a text answer.
- Sends prompt to Gemini 2.0 Flash (
- Display:
- Shows the answer word-by-word with a typing effect, then “balloons” celebration.
- All messages are stored in
st.session_state.messagesfor chat history.
- Upload your
.txtfile (up to a few MB). - Type a question in the “What is up?” input box.
- Read the assistant’s streamed answer.
- Repeat as needed—your past conversation remains visible.
Example queries:
- “Summarize the main arguments.”
- “What are the key dates mentioned?”
- “Find all occurrences of the word ‘character.’”
- 📄 Support for PDF, DOCX, and other formats
- 🔍 Adjustable number of returned chunks (
kparameter) - 🔐 User authentication and per-user DB isolation
- 📱 Responsive UI for mobile devices
- 📂 Multi‐file chat & history export
© 2025 Yash Deepak Bambore · GitHub Repository