Used main as base branch in the last time

This commit is contained in:
Carlos Mesquita
2024-07-25 16:55:42 +01:00
parent 8b8460517c
commit ca12ad1161
9 changed files with 93 additions and 43 deletions

9
app.py
View File

@@ -15,6 +15,7 @@ from helper.heygen_api import create_video, create_videos_and_save_to_db
from helper.openai_interface import *
from helper.question_templates import *
from helper.speech_to_text_helper import *
from helper.gpt_zero import GPTZero
from heygen.AvatarEnum import AvatarEnum
load_dotenv()
@@ -30,6 +31,8 @@ FIREBASE_BUCKET = os.getenv('FIREBASE_BUCKET')
firebase_admin.initialize_app(cred)
gpt_zero = GPTZero(os.getenv('GPT_ZERO_API_KEY'))
thread_event = threading.Event()
# Configure logging
@@ -309,6 +312,9 @@ def grade_writing_task_1():
response["perfect_answer"] = get_perfect_answer(question, 150)["perfect_answer"]
response["overall"] = fix_writing_overall(response["overall"], response["task_response"])
response['fixed_text'] = get_fixed_text(answer)
ai_detection = gpt_zero.run_detection(answer)
if ai_detection is not None:
response['ai_detection'] = ai_detection
return response
except Exception as e:
return str(e)
@@ -449,6 +455,9 @@ def grade_writing_task_2():
response["perfect_answer"] = get_perfect_answer(question, 250)["perfect_answer"]
response["overall"] = fix_writing_overall(response["overall"], response["task_response"])
response['fixed_text'] = get_fixed_text(answer)
ai_detection = gpt_zero.run_detection(answer)
if ai_detection is not None:
response['ai_detection'] = ai_detection
return response
except Exception as e:
return str(e)