aeravat-quiz-generation / quizGeneration.py
siddhantuniyal's picture
Upload 2 files
7a2beb4 verified
raw
history blame
No virus
883 Bytes
import google.generativeai as genai
import gradio as gr
api_key = "AIzaSyAMfftpsTHFJx-4xhoOAKCM-Uc42SKOb98"
model = genai.GenerativeModel('gemini-pro')
genai.configure(api_key = api_key)
chat = model.start_chat(history=[])
temp = chat.send_message(f"""
You are an expert quiz designer based on lecture notes LLM. Your task is to take notes of a lecture, and
turn them into notes.""")
def generate_quiz(prompt):
input = """
Generate a quiz of 5 questions from these notes of a lecture , each of the format :\n
Q) Question\n
a) Option A\n
b) Option B\n
c) Option C\n
d) Option D\n
""" + prompt
output = chat.send_message(input)
return output.text
iface = gr.Interface(
fn= generate_quiz,
inputs= "text",
outputs= "text",
title="Aeravat Quiz Generation",
)
# Launch the Gradio interface
iface.launch(share=True)