Spaces:
Runtime error
Runtime error
Commit
·
7e09f8c
1
Parent(s):
327d778
Update app.py
Browse files
app.py
CHANGED
@@ -12,7 +12,7 @@ mcq_prompt = "Generate French MCQs on the above text. Each MCQ must have four ch
|
|
12 |
openai.api_key = os.environ["openai_api_key"]
|
13 |
access_code = os.environ["access_code"]
|
14 |
|
15 |
-
def generate_questions(context, credentials, mcq_prompt=mcq_prompt):
|
16 |
"""
|
17 |
Generate questions by calling davinci-003.
|
18 |
"""
|
@@ -43,9 +43,13 @@ with gr.Blocks() as demo:
|
|
43 |
credentials = gr.Textbox("Code d'accès.", interactive=True)
|
44 |
|
45 |
with gr.Row():
|
|
|
|
|
46 |
|
47 |
-
|
48 |
-
|
|
|
|
|
49 |
qa_pairs = gr.Textbox(placeholder="Les questions apparaîtront ici.", lines=10)
|
50 |
|
51 |
#todo: test generating with just one phrase for one MCQ with smaller models
|
@@ -53,7 +57,7 @@ with gr.Blocks() as demo:
|
|
53 |
quiz_button = gr.Button("Générer dix questions.")
|
54 |
|
55 |
quiz_button.click(fn=generate_questions,
|
56 |
-
inputs=[context, credentials],
|
57 |
outputs=qa_pairs)
|
58 |
|
59 |
if __name__ == "__main__":
|
|
|
12 |
openai.api_key = os.environ["openai_api_key"]
|
13 |
access_code = os.environ["access_code"]
|
14 |
|
15 |
+
def generate_questions(context, credentials, num_questions, mcq_prompt=mcq_prompt):
|
16 |
"""
|
17 |
Generate questions by calling davinci-003.
|
18 |
"""
|
|
|
43 |
credentials = gr.Textbox("Code d'accès.", interactive=True)
|
44 |
|
45 |
with gr.Row():
|
46 |
+
|
47 |
+
with gr.Column():
|
48 |
|
49 |
+
context = gr.Textbox(placeholder="Insérez le texte ici.", lines=10)
|
50 |
+
|
51 |
+
slider = gr.Slider(minimum=1, maximum=10, value=5, step=1, label="Nombre de questions.")
|
52 |
+
|
53 |
qa_pairs = gr.Textbox(placeholder="Les questions apparaîtront ici.", lines=10)
|
54 |
|
55 |
#todo: test generating with just one phrase for one MCQ with smaller models
|
|
|
57 |
quiz_button = gr.Button("Générer dix questions.")
|
58 |
|
59 |
quiz_button.click(fn=generate_questions,
|
60 |
+
inputs=[context, credentials, slider],
|
61 |
outputs=qa_pairs)
|
62 |
|
63 |
if __name__ == "__main__":
|