Question Paper Setter Using CHAT-GPT using React JS
The question “Can we use CHAT GPT to help teachers?” crossed my head a few days ago.
I made the decision to create a website that is accessible to everyone, regardless of device.
The only information you need to enter is the number of questions to be framed, together with the block of text from which you wish to phrase the questions.
CHAT-GPT will pose questions based on how well the paragraph is written.
When a paragraph is informative, CHAT-GPT creates multiple-choice questions (MCQs) with answers; but, when a paragraph is neutral, it frames When, What, and Where inquiries.
Depending on your requirements, you can modify the query that is used as an input by the CHAT-GPT. You’ll get more comparable results if your query is better.
What actually occurs in the background is that a JavaScript file called openai.js makes an API call to the CHAT-GPT, which then returns a series of questions as the result.
(Note :- The maximum number of questions you can receive in the output is 10, which is a CHAT-GPT restriction.)
Get Deepankar Varma’s stories in your inbox
Join Medium for free to get updates from this writer.
The working source code is available at :-
QuickStart
- Clone this repository.
- Add your OpenAI API key to .env file (sign up at https://beta.openai.com for account / key)
- Install node_modules by running
npm installoryarn installin terminal - In
pages/api/openai.jsyou construct your request to OpenAI API - In
pages/index.jsyou tweak your UI/UX - Start the dev server with
yarn devornpm run devcommand - Run
setxcommand in cmd for setting the API Key in the environment variables - Incase you get browser outdated error, run
npm install browserslist - For any other major errors try removing the node modues , package.json and run the
npm installagain.
For help related to API connection visit OpenAI
How to use
Simply paste a paragraph in the first textarea and then enter the number of MCQ questions you need in the second textarea.Finally use the Frame Questions button to generate questions. The maximum questions generated at a time is 10 (Limitation from CHAT GPT).
Working Screenshot
Tips
If you don’t have a setup on your computer that allow to run code locally, then use https://replit.com/

