This API allows users to generate flashcards from various input sources, including text, PDF, PPTX, DOCX, and CSV files. The generated flashcards consist of questions and answers focusing on key concepts from the input text, with support for both traditional and cloze deletion formats.
https://flashcard-generator-mdhf.onrender.com/
-
POST /flashcard/
Generates flashcards based on the provided input method and type.
Request Body:
method(string, required): The method of input (options:pdf,pptx,docx,csv,text).type(string, required): The type of flashcards to generate (options:type-Ifor traditional,type-IIfor cloze deletion).text(string, optional): The text input (required ifmethodistext).file(file, optional): The file to upload (required forpdf,pptx,docx, andcsvmethods).
Request Example:
POST /flashcard/ Content-Type: multipart/form-data method: pdf type: type-I file: <PDF file>Response: Returns a list of generated flashcards.
{ "flashcards": [ { "question": "What is...?", "answer": "..." }, ... ] }For cloze deletion flashcards (type-II), the response will be:
{ "flashcards": [ { "question_with_blanks": "______ is a programming language.", "correct_answers": ["Python"] }, ... ] }Error Responses:
- 400 Bad Request
- If the file format is incorrect or missing.
- If text is not provided when required.
- If an invalid method is specified.
- 500 Internal Server Error
- If there's an error processing the request.
-
PDF
- Description: Upload a
.pdffile to extract text and generate flashcards. - File Type:
.pdf - Example Request:
POST /flashcard/ method: pdf type: type-I file: <PDF file>
- Description: Upload a
-
PPTX
- Description: Upload a
.pptxfile to extract text from slides and generate flashcards. - File Type:
.pptx - Example Request:
POST /flashcard/ method: pptx type: type-I file: <PPTX file>
- Description: Upload a
-
DOCX
- Description: Upload a
.docxfile to extract text from paragraphs and generate flashcards. - File Type:
.docx - Example Request:
POST /flashcard/ method: docx type: type-II file: <DOCX file>
- Description: Upload a
-
CSV
- Description: Upload a
.csvfile to extract data and generate flashcards. - File Type:
.csv - Example Request:
POST /flashcard/ method: csv type: type-I file: <CSV file>
- Description: Upload a
-
Text
- Description: Provide raw text input for flashcard generation.
- Example Request:
POST /flashcard/ method: text type: type-II text: "This is a sample text for flashcard generation."
-
Traditional (type-I)
- Consists of a question and an answer pair.
- Suitable for direct question-answer style learning.
-
Cloze Deletion (type-II)
- Presents a sentence with blanks and the correct answers to fill those blanks.
- Ideal for context-based learning and fill-in-the-blank exercises.
- Ensure that the file formats, methods, and flashcard types are correctly specified to avoid errors.
- The API will return a list of flashcards generated from the provided input, formatted according to the specified type.
- The server is hosted on Render, so the base URL is https://flashcard-generator-mdhf.onrender.com/.