Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -178,6 +178,13 @@ def display_response(response_key, response):
|
|
178 |
file_name=f"{response_key}.txt"
|
179 |
)
|
180 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
if selected_tool == "Personalized Learning Assistant":
|
182 |
st.header("Personalized Learning Assistant")
|
183 |
with st.form(key="learning_form"):
|
@@ -188,17 +195,19 @@ if selected_tool == "Personalized Learning Assistant":
|
|
188 |
st.session_state['responses']['personalized_learning_assistant'] = explanation
|
189 |
if st.session_state['responses']['personalized_learning_assistant']:
|
190 |
display_response("personalized_learning_assistant", st.session_state['responses']['personalized_learning_assistant'])
|
|
|
191 |
|
192 |
elif selected_tool == "AI Coding Mentor":
|
193 |
st.header("AI Coding Mentor")
|
194 |
with st.form(key="coding_form"):
|
195 |
-
code_input = st.text_area("
|
196 |
-
submit_button = st.form_submit_button("Review
|
197 |
if submit_button:
|
198 |
review = ai_coding_mentor(code_input)
|
199 |
st.session_state['responses']['ai_coding_mentor'] = review
|
200 |
if st.session_state['responses']['ai_coding_mentor']:
|
201 |
display_response("ai_coding_mentor", st.session_state['responses']['ai_coding_mentor'])
|
|
|
202 |
|
203 |
elif selected_tool == "Smart Document Summarizer":
|
204 |
st.header("Smart Document Summarizer")
|
@@ -210,6 +219,7 @@ elif selected_tool == "Smart Document Summarizer":
|
|
210 |
st.session_state['responses']['smart_document_summarizer'] = summary
|
211 |
if st.session_state['responses']['smart_document_summarizer']:
|
212 |
display_response("smart_document_summarizer", st.session_state['responses']['smart_document_summarizer'])
|
|
|
213 |
|
214 |
elif selected_tool == "Interactive Study Planner":
|
215 |
st.header("Interactive Study Planner")
|
@@ -221,6 +231,7 @@ elif selected_tool == "Interactive Study Planner":
|
|
221 |
st.session_state['responses']['interactive_study_planner'] = study_plan
|
222 |
if st.session_state['responses']['interactive_study_planner']:
|
223 |
display_response("interactive_study_planner", st.session_state['responses']['interactive_study_planner'])
|
|
|
224 |
|
225 |
elif selected_tool == "Real-Time Q&A Support":
|
226 |
st.header("Real-Time Q&A Support")
|
@@ -232,6 +243,7 @@ elif selected_tool == "Real-Time Q&A Support":
|
|
232 |
st.session_state['responses']['real_time_qa_support'] = answer
|
233 |
if st.session_state['responses']['real_time_qa_support']:
|
234 |
display_response("real_time_qa_support", st.session_state['responses']['real_time_qa_support'])
|
|
|
235 |
|
236 |
elif selected_tool == "Mental Health Check-In":
|
237 |
st.header("Mental Health Check-In")
|
@@ -243,6 +255,7 @@ elif selected_tool == "Mental Health Check-In":
|
|
243 |
st.session_state['responses']['mental_health_check_in'] = advice
|
244 |
if st.session_state['responses']['mental_health_check_in']:
|
245 |
display_response("mental_health_check_in", st.session_state['responses']['mental_health_check_in'])
|
|
|
246 |
|
247 |
# Footer with social media links
|
248 |
st.markdown("""
|
|
|
178 |
file_name=f"{response_key}.txt"
|
179 |
)
|
180 |
|
181 |
+
# Function to handle image uploads
|
182 |
+
def upload_image():
|
183 |
+
st.header("Image Upload")
|
184 |
+
image = st.file_uploader("Choose an image", type=["png", "jpg", "jpeg"])
|
185 |
+
if image is not None:
|
186 |
+
st.image(image, caption="Uploaded Image", use_column_width=True)
|
187 |
+
|
188 |
if selected_tool == "Personalized Learning Assistant":
|
189 |
st.header("Personalized Learning Assistant")
|
190 |
with st.form(key="learning_form"):
|
|
|
195 |
st.session_state['responses']['personalized_learning_assistant'] = explanation
|
196 |
if st.session_state['responses']['personalized_learning_assistant']:
|
197 |
display_response("personalized_learning_assistant", st.session_state['responses']['personalized_learning_assistant'])
|
198 |
+
upload_image()
|
199 |
|
200 |
elif selected_tool == "AI Coding Mentor":
|
201 |
st.header("AI Coding Mentor")
|
202 |
with st.form(key="coding_form"):
|
203 |
+
code_input = st.text_area("Paste your code snippet", placeholder="e.g., for i in range(10): print(i)")
|
204 |
+
submit_button = st.form_submit_button("Get Review")
|
205 |
if submit_button:
|
206 |
review = ai_coding_mentor(code_input)
|
207 |
st.session_state['responses']['ai_coding_mentor'] = review
|
208 |
if st.session_state['responses']['ai_coding_mentor']:
|
209 |
display_response("ai_coding_mentor", st.session_state['responses']['ai_coding_mentor'])
|
210 |
+
upload_image()
|
211 |
|
212 |
elif selected_tool == "Smart Document Summarizer":
|
213 |
st.header("Smart Document Summarizer")
|
|
|
219 |
st.session_state['responses']['smart_document_summarizer'] = summary
|
220 |
if st.session_state['responses']['smart_document_summarizer']:
|
221 |
display_response("smart_document_summarizer", st.session_state['responses']['smart_document_summarizer'])
|
222 |
+
upload_image()
|
223 |
|
224 |
elif selected_tool == "Interactive Study Planner":
|
225 |
st.header("Interactive Study Planner")
|
|
|
231 |
st.session_state['responses']['interactive_study_planner'] = study_plan
|
232 |
if st.session_state['responses']['interactive_study_planner']:
|
233 |
display_response("interactive_study_planner", st.session_state['responses']['interactive_study_planner'])
|
234 |
+
upload_image()
|
235 |
|
236 |
elif selected_tool == "Real-Time Q&A Support":
|
237 |
st.header("Real-Time Q&A Support")
|
|
|
243 |
st.session_state['responses']['real_time_qa_support'] = answer
|
244 |
if st.session_state['responses']['real_time_qa_support']:
|
245 |
display_response("real_time_qa_support", st.session_state['responses']['real_time_qa_support'])
|
246 |
+
upload_image()
|
247 |
|
248 |
elif selected_tool == "Mental Health Check-In":
|
249 |
st.header("Mental Health Check-In")
|
|
|
255 |
st.session_state['responses']['mental_health_check_in'] = advice
|
256 |
if st.session_state['responses']['mental_health_check_in']:
|
257 |
display_response("mental_health_check_in", st.session_state['responses']['mental_health_check_in'])
|
258 |
+
upload_image()
|
259 |
|
260 |
# Footer with social media links
|
261 |
st.markdown("""
|