Spaces:
Sleeping
Sleeping
jeremierostan
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -30,7 +30,8 @@ def generate_question(paper_text):
|
|
30 |
messages=[{"role": "user", "content": prompt}],
|
31 |
model="llama-3.1-70b-versatile"
|
32 |
)
|
33 |
-
|
|
|
34 |
|
35 |
# Validate the student's answer using Groq (Improved Prompt)
|
36 |
def validate_answer(paper_text, student_answer):
|
@@ -49,7 +50,8 @@ def validate_answer(paper_text, student_answer):
|
|
49 |
messages=[{"role": "user", "content": prompt}],
|
50 |
model="llama-3.1-70b-versatile"
|
51 |
)
|
52 |
-
|
|
|
53 |
|
54 |
# Function to determine authorship based on multiple interactions
|
55 |
def determine_authorship(paper_text, student_answers, interaction_count):
|
@@ -68,7 +70,8 @@ def determine_authorship(paper_text, student_answers, interaction_count):
|
|
68 |
messages=[{"role": "user", "content": prompt}],
|
69 |
model="llama-3.1-70b-versatile"
|
70 |
)
|
71 |
-
|
|
|
72 |
|
73 |
# Mailjet Email Sending Function
|
74 |
def send_email(pdf_file, student_answer, verification_status):
|
@@ -141,7 +144,10 @@ with gr.Blocks() as app:
|
|
141 |
submit_btn = gr.Button("Submit Answer")
|
142 |
output = gr.Textbox(label="Result")
|
143 |
|
|
|
|
|
144 |
submit_btn.click(fn=main_app, inputs=[pdf_file, student_answer], outputs=output)
|
145 |
|
146 |
# Launch the app
|
147 |
app.launch()
|
|
|
|
30 |
messages=[{"role": "user", "content": prompt}],
|
31 |
model="llama-3.1-70b-versatile"
|
32 |
)
|
33 |
+
# Access the message content properly, no subscripting
|
34 |
+
return response.choices[0].message.content
|
35 |
|
36 |
# Validate the student's answer using Groq (Improved Prompt)
|
37 |
def validate_answer(paper_text, student_answer):
|
|
|
50 |
messages=[{"role": "user", "content": prompt}],
|
51 |
model="llama-3.1-70b-versatile"
|
52 |
)
|
53 |
+
# Access the message content properly, no subscripting
|
54 |
+
return response.choices[0].message.content
|
55 |
|
56 |
# Function to determine authorship based on multiple interactions
|
57 |
def determine_authorship(paper_text, student_answers, interaction_count):
|
|
|
70 |
messages=[{"role": "user", "content": prompt}],
|
71 |
model="llama-3.1-70b-versatile"
|
72 |
)
|
73 |
+
# Access the message content properly, no subscripting
|
74 |
+
return response.choices[0].message.content
|
75 |
|
76 |
# Mailjet Email Sending Function
|
77 |
def send_email(pdf_file, student_answer, verification_status):
|
|
|
144 |
submit_btn = gr.Button("Submit Answer")
|
145 |
output = gr.Textbox(label="Result")
|
146 |
|
147 |
+
# Ensure that the file upload triggers the processing and the student can submit their answer
|
148 |
+
pdf_file.upload(fn=extract_text_from_pdf, inputs=pdf_file, outputs=None)
|
149 |
submit_btn.click(fn=main_app, inputs=[pdf_file, student_answer], outputs=output)
|
150 |
|
151 |
# Launch the app
|
152 |
app.launch()
|
153 |
+
|