Spaces:
Sleeping
Sleeping
updated the prompt
Browse files
app.py
CHANGED
|
@@ -75,12 +75,8 @@ def multimodal_prompt(pdf_path, text_prompt, file_type="PDF"):
|
|
| 75 |
else:
|
| 76 |
return "Invalid file_type. Must be 'PDF' or 'image'."
|
| 77 |
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
st.session_state.uploaded_file_part = pdf_part
|
| 81 |
-
prompt = [text_prompt, pdf_part] # First turn includes the actual file
|
| 82 |
-
else: # Subsequent turns, reference the file
|
| 83 |
-
prompt = [text_prompt, st.session_state.uploaded_file_part] # Subsequent turns include the file reference
|
| 84 |
|
| 85 |
response = chat.send_message(prompt)
|
| 86 |
|
|
@@ -151,7 +147,11 @@ if problem_step == 0:
|
|
| 151 |
st.write("Image saved to:", image_path)
|
| 152 |
|
| 153 |
# create the text prompt
|
| 154 |
-
text_prompt = "Use the provided image. The image
|
|
|
|
|
|
|
|
|
|
|
|
|
| 155 |
|
| 156 |
if st.button("Ask Tutor for Feedback"):
|
| 157 |
if text_prompt:
|
|
|
|
| 75 |
else:
|
| 76 |
return "Invalid file_type. Must be 'PDF' or 'image'."
|
| 77 |
|
| 78 |
+
pdf_part = genai.upload_file(pdf_path, mime_type=mime_type)
|
| 79 |
+
prompt = [text_prompt, pdf_part] # First turn includes the actual file
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
|
| 81 |
response = chat.send_message(prompt)
|
| 82 |
|
|
|
|
| 147 |
st.write("Image saved to:", image_path)
|
| 148 |
|
| 149 |
# create the text prompt
|
| 150 |
+
text_prompt = """Use the provided image. The image shows,
|
| 151 |
+
a student's answer to the problem. Evaluate the answer and provide a correct solution.
|
| 152 |
+
Provide feedback how can the student improve their answer. If the student used the factoring method,
|
| 153 |
+
ask the student to try again and this time use the quadratic formula method.
|
| 154 |
+
"""
|
| 155 |
|
| 156 |
if st.button("Ask Tutor for Feedback"):
|
| 157 |
if text_prompt:
|