Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
@@ -189,12 +189,31 @@ def add_mentor():
|
|
189 |
mentor_details = f"\n{mentor_name}\nSkills: {skills}\nQualification: {qualification}\nExperience: {experience}\n"
|
190 |
|
191 |
try:
|
192 |
-
with open("
|
193 |
file.write(mentor_details)
|
194 |
-
return jsonify({"message": "Mentor will added after verification"}), 201
|
195 |
except Exception as e:
|
196 |
return jsonify({"message": f"Failed to add mentor: {str(e)}"}), 500
|
197 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
@app.route('/ai_mentor', methods=['POST'])
|
199 |
@jwt_required()
|
200 |
def ai_mentor():
|
|
|
189 |
mentor_details = f"\n{mentor_name}\nSkills: {skills}\nQualification: {qualification}\nExperience: {experience}\n"
|
190 |
|
191 |
try:
|
192 |
+
with open("temp_mentor.txt", "a") as file:
|
193 |
file.write(mentor_details)
|
194 |
+
return jsonify({"message": "Mentor will be added after verification"}), 201
|
195 |
except Exception as e:
|
196 |
return jsonify({"message": f"Failed to add mentor: {str(e)}"}), 500
|
197 |
|
198 |
+
@app.route('/verify_mentor', methods=['POST'])
|
199 |
+
def verify_mentor():
|
200 |
+
try:
|
201 |
+
with open("temp_mentor.txt", "r") as file:
|
202 |
+
mentors = file.readlines()
|
203 |
+
|
204 |
+
if not mentors:
|
205 |
+
return jsonify({"message": "No mentors to verify"}), 404
|
206 |
+
|
207 |
+
with open("mentor.txt", "a") as mentor_file:
|
208 |
+
for mentor_details in mentors:
|
209 |
+
mentor_file.write(mentor_details)
|
210 |
+
|
211 |
+
open("temp_mentor.txt", "w").close()
|
212 |
+
|
213 |
+
return jsonify({"message": "Mentors verified and added successfully"}), 200
|
214 |
+
except Exception as e:
|
215 |
+
return jsonify({"message": f"Failed to verify mentors: {str(e)}"}), 500
|
216 |
+
|
217 |
@app.route('/ai_mentor', methods=['POST'])
|
218 |
@jwt_required()
|
219 |
def ai_mentor():
|