Neurolingua
commited on
Commit
•
ac50364
1
Parent(s):
e314026
Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,7 @@ import joblib
|
|
2 |
from flask import Flask, render_template, request, jsonify,session
|
3 |
from werkzeug.utils import secure_filename
|
4 |
import os
|
5 |
-
from student_functions import extract_text_from_pdf_s,generate_ai_response,generate_project_idea,generate_project_idea_questions,generate_quiz,generate_response_from_pdf,
|
6 |
from teacher_function import evaluate,extract_text_from_image,extract_text_from_pdf,generate_questions_from_text,generate_student_report,generate_timetable_module,cluster_topics,generate_timetable_weak
|
7 |
import shutil
|
8 |
from ai71 import AI71
|
@@ -154,7 +154,7 @@ def upload_image_for_ocr():
|
|
154 |
file_path = os.path.join(app.config['UPLOAD_FOLDER'], filename)
|
155 |
file.save(file_path)
|
156 |
|
157 |
-
extracted_text =
|
158 |
ai_response = generate_ai_response(extracted_text)
|
159 |
|
160 |
return jsonify({'ai_response': ai_response})
|
@@ -482,12 +482,12 @@ def eval():
|
|
482 |
if question_path.endswith('.pdf'):
|
483 |
question_text = extract_text_from_pdf(question_path)
|
484 |
else:
|
485 |
-
question_text =
|
486 |
|
487 |
if answer_path.endswith('.pdf'):
|
488 |
answer_text = extract_text_from_pdf(answer_path)
|
489 |
else:
|
490 |
-
answer_text =
|
491 |
|
492 |
elif input_type == 'text':
|
493 |
question_text = request.form['question_text']
|
|
|
2 |
from flask import Flask, render_template, request, jsonify,session
|
3 |
from werkzeug.utils import secure_filename
|
4 |
import os
|
5 |
+
from student_functions import extract_text_from_pdf_s,generate_ai_response,generate_project_idea,generate_project_idea_questions,generate_quiz,generate_response_from_pdf,generate_step_by_step_explanatiom,study_plan,ConversationBufferMemory,get_first_youtube_video_link,content_translate,summarise_text,content_translate
|
6 |
from teacher_function import evaluate,extract_text_from_image,extract_text_from_pdf,generate_questions_from_text,generate_student_report,generate_timetable_module,cluster_topics,generate_timetable_weak
|
7 |
import shutil
|
8 |
from ai71 import AI71
|
|
|
154 |
file_path = os.path.join(app.config['UPLOAD_FOLDER'], filename)
|
155 |
file.save(file_path)
|
156 |
|
157 |
+
extracted_text = extract_text_from_image(file_path)
|
158 |
ai_response = generate_ai_response(extracted_text)
|
159 |
|
160 |
return jsonify({'ai_response': ai_response})
|
|
|
482 |
if question_path.endswith('.pdf'):
|
483 |
question_text = extract_text_from_pdf(question_path)
|
484 |
else:
|
485 |
+
question_text = extract_text_from_image(question_path)
|
486 |
|
487 |
if answer_path.endswith('.pdf'):
|
488 |
answer_text = extract_text_from_pdf(answer_path)
|
489 |
else:
|
490 |
+
answer_text = extract_text_from_image(answer_path)
|
491 |
|
492 |
elif input_type == 'text':
|
493 |
question_text = request.form['question_text']
|