This project provides a FastAPI-based API for generating mind maps based on course details. The API is hosted on Render and can be easily integrated into various applications.
- Hosted URL: https://mind-map-api-yn7x.onrender.com
- Endpoint:
/generate-mindmap/
(POST request)
The API accepts a JSON payload with the following parameters:
course_title
(string): The title of the course.key_concepts
(string): A comma-separated list of key concepts, themes, and central ideas.granularity_level
(string): The desired level of detail (e.g., "Overview", "Detailed Overview", "Comprehensive Breakdown", "In-Depth Analysis", "Exhaustive Detail").course_duration
(string): The duration of the course (e.g., "1 week", "1 month", "3 months", "6 months", "1 year").target_audience
(string): The intended audience for the course (e.g., "Beginners", "Intermediate", "Advanced").learning_objectives
(string): A comma-separated list of main learning objectives for the course.
Here's an example of how to use the API using Python's requests
library:
import requests
url = "https://mind-map-api-yn7x.onrender.com/generate-mindmap/"
payload = {
"course_title": "Introduction to Python Programming",
"key_concepts": "Variables, Data Types, Control Structures, Functions, Object-Oriented Programming",
"granularity_level": "Detailed Overview",
"course_duration": "1 month",
"target_audience": "Beginners",
"learning_objectives": "Understand basic Python syntax, Write simple Python programs, Implement basic algorithms"
}
response = requests.post(url, json=payload)
if response.status_code == 200:
mind_map = response.json()['markdown']
print(mind_map)
else:
print(f"Error: {response.status_code}")
print(response.text)
This repository includes an HTML file (demo.html
) that demonstrates how to use the API with JavaScript. To use the demo:
- Clone this repository.
- Open
demo.html
in a web browser. - Click the "Generate Mind Map" button to send a request to the API with hardcoded data.
- The generated mind map will be displayed on the page in Markdown format.
The API returns a JSON object with a single key markdown
, containing the generated mind map in Markdown format.
If an error occurs, the API will return an appropriate HTTP status code along with an error message in the response body.
Happy mind mapping!