Spaces:
Runtime error
Runtime error
siddhantuniyal
commited on
Upload 2 files
Browse files- quizGeneration.py +33 -0
- requirements.txt +2 -0
quizGeneration.py
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import google.generativeai as genai
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
api_key = "AIzaSyAMfftpsTHFJx-4xhoOAKCM-Uc42SKOb98"
|
5 |
+
|
6 |
+
model = genai.GenerativeModel('gemini-pro')
|
7 |
+
genai.configure(api_key = api_key)
|
8 |
+
chat = model.start_chat(history=[])
|
9 |
+
temp = chat.send_message(f"""
|
10 |
+
You are an expert quiz designer based on lecture notes LLM. Your task is to take notes of a lecture, and
|
11 |
+
turn them into notes.""")
|
12 |
+
|
13 |
+
def generate_quiz(prompt):
|
14 |
+
input = """
|
15 |
+
Generate a quiz of 5 questions from these notes of a lecture , each of the format :\n
|
16 |
+
Q) Question\n
|
17 |
+
a) Option A\n
|
18 |
+
b) Option B\n
|
19 |
+
c) Option C\n
|
20 |
+
d) Option D\n
|
21 |
+
""" + prompt
|
22 |
+
output = chat.send_message(input)
|
23 |
+
return output.text
|
24 |
+
|
25 |
+
iface = gr.Interface(
|
26 |
+
fn= generate_quiz,
|
27 |
+
inputs= "text",
|
28 |
+
outputs= "text",
|
29 |
+
title="Aeravat Quiz Generation",
|
30 |
+
)
|
31 |
+
|
32 |
+
# Launch the Gradio interface
|
33 |
+
iface.launch(share=True)
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
gradio
|
2 |
+
google.generativeai
|