Demo : https://mindmapgenrator.streamlit.app/
This Streamlit application generates detailed, hierarchical mind maps using Google's Generative AI (Gemini Pro) and visualizes them using Markmap. The app takes a topic as input and creates an interactive, expandable mind map with rich markdown formatting.
- 🤖 Powered by Google's Gemini Pro AI model
- 📊 Interactive mind map visualization
- 🎨 Rich markdown formatting support
- 🔒 Secure API key handling
- 📱 Responsive layout
- 💾 Session state persistence
- Python 3.7+
- Google API key (Gemini Pro access)
- Internet connection
- Clone the repository:
git clone [your-repository-url]
cd [repository-name]
- Install required packages:
pip install -r requirements.txt
streamlit
streamlit-markmap
google-generativeai
-
Obtain a Google API key for Gemini Pro access:
- Visit the Google AI Studio
- Create an API key for Gemini Pro
-
The API key can be:
- Entered directly in the application sidebar
- Set as an environment variable:
export GOOGLE_API_KEY='your-api-key'
- Start the application:
streamlit run app.py
-
Access the application in your web browser (typically http://localhost:8501)
-
Enter your Google API key in the sidebar
-
Input your topic in the text area
-
Click "Submit" to generate and visualize the mind map
-
Page Configuration
- Wide layout
- Custom page title
-
Sidebar
- Google API key input
- Secure password field
-
Main Interface
- Topic input text area
- Submit button
- Markmap visualization
-
Session State Management
- Persistent API key storage
- Cache for markdown generation
- Initializes the Streamlit application
- Manages session state
- Handles user interface elements
- Cached function for markdown generation
- Parameters:
input_data
: User-provided topic string
- Returns:
- Generated markdown content or "Invalid" on error
- Uses Gemini Pro for content generation
The application generates markdown with:
- Bold text for parent nodes
- Italic text for emphasis
- ==Highlighted== text for important points
- Nested hierarchical structure
- Invalid API key detection
- Error message display
- Graceful failure handling
- API key is never displayed
- Password field for secure input
- Session state for temporary storage
You can modify the prompt template in create_markdown()
to adjust:
- Content structure
- Formatting style
- Detail level
- Language style
- Uses
@st.cache_data
for efficient markdown generation - Minimizes API calls
- Optimized for responsiveness
- Requires active internet connection
- API key required for operation
- Rate limits based on Google API quota
Common issues and solutions:
-
Invalid API Key Error
- Verify API key is correct
- Check Google Cloud Console for API activation
- Ensure Gemini Pro API access is enabled
-
Visualization Not Loading
- Check internet connection
- Clear browser cache
- Refresh the page
Contributions are welcome! Please feel free to submit a Pull Request.
- Streamlit team for the framework
- Markmap developers
- Google Generative AI team