Spaces:
Runtime error
Runtime error
Delete app.py
Browse files
app.py
DELETED
|
@@ -1,36 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
from google import genai
|
| 3 |
-
from google.genai import types
|
| 4 |
-
import gradio as gr
|
| 5 |
-
|
| 6 |
-
client=genai.Client(api_key=os.getenv("GEMINI_API_KEY"))
|
| 7 |
-
|
| 8 |
-
Question_type={
|
| 9 |
-
"MCQs":"Generate question of MCQs type based upon the content given.",
|
| 10 |
-
"Short Answer":"Generate question of short-answer type based upon the content given.",
|
| 11 |
-
"Interview":"Generate question of Interview type based upon the content given."
|
| 12 |
-
}
|
| 13 |
-
def question_generator(content,question_type):
|
| 14 |
-
system_prompt=Question_type[question_type]
|
| 15 |
-
|
| 16 |
-
response=client.models.generate_content(
|
| 17 |
-
model="gemini-2.5-flash",
|
| 18 |
-
config=types.GenerateContentConfig(
|
| 19 |
-
system_instruction=system_prompt,
|
| 20 |
-
temperature=0.7,
|
| 21 |
-
max_output_tokens=1000
|
| 22 |
-
),
|
| 23 |
-
contents=content
|
| 24 |
-
)
|
| 25 |
-
return response.text
|
| 26 |
-
|
| 27 |
-
demo=gr.Interface(
|
| 28 |
-
fn=question_generator,
|
| 29 |
-
inputs=[gr.Textbox(lines=4,placeholder="Paste Content/study material...",label="inputContent"),
|
| 30 |
-
gr.Dropdown(choices=list(Question_type.keys()),label="question_type",value="MCQs")],
|
| 31 |
-
outputs=gr.Textbox(lines=12,label="Generated Questions"),
|
| 32 |
-
title="Question Generator",
|
| 33 |
-
description="Paste the Content/Study material and get the questions of the selected type."
|
| 34 |
-
)
|
| 35 |
-
|
| 36 |
-
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|