Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,12 +4,6 @@ import csv
|
|
| 4 |
from dotenv import load_dotenv
|
| 5 |
import os
|
| 6 |
|
| 7 |
-
load_dotenv()
|
| 8 |
-
|
| 9 |
-
def authenticate(user,password):
|
| 10 |
-
if user == os.getenv("username") and password == os.getenv("password"):
|
| 11 |
-
return True
|
| 12 |
-
return False
|
| 13 |
|
| 14 |
def generate_questions(topic):
|
| 15 |
llmConnect.addToDataset(topic)
|
|
@@ -101,4 +95,28 @@ with gr.Blocks() as demo:
|
|
| 101 |
outputs=[score]
|
| 102 |
)
|
| 103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
demo.launch()
|
|
|
|
| 4 |
from dotenv import load_dotenv
|
| 5 |
import os
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
def generate_questions(topic):
|
| 9 |
llmConnect.addToDataset(topic)
|
|
|
|
| 95 |
outputs=[score]
|
| 96 |
)
|
| 97 |
|
| 98 |
+
with gr.Row():
|
| 99 |
+
with gr.Column():
|
| 100 |
+
report = gr.Textbox(
|
| 101 |
+
label="Report",
|
| 102 |
+
placeholder="Your report will be displayed here"
|
| 103 |
+
)
|
| 104 |
+
|
| 105 |
+
def generate_report(answers):
|
| 106 |
+
data = readDataset()
|
| 107 |
+
report = []
|
| 108 |
+
for i in range(len(answers)):
|
| 109 |
+
question = data[i][1]
|
| 110 |
+
user_answer = answers[i]
|
| 111 |
+
correct_answer = data[i][1+int(data[i][6])]
|
| 112 |
+
report.append(f"Q{i+1}: {question}\nYour answer: {user_answer}\nCorrect answer: {correct_answer}\n")
|
| 113 |
+
return "\n".join(report)
|
| 114 |
+
|
| 115 |
+
reportGen = gr.Button(value="Generate Report")
|
| 116 |
+
reportGen.click(
|
| 117 |
+
generate_report,
|
| 118 |
+
inputs=[user_answers],
|
| 119 |
+
outputs=[report]
|
| 120 |
+
)
|
| 121 |
+
|
| 122 |
demo.launch()
|