58 lines
1.6 KiB
Python
58 lines
1.6 KiB
Python
from abc import ABC, abstractmethod
|
|
from typing import List, Dict
|
|
|
|
|
|
class ISpeakingService(ABC):
|
|
|
|
@abstractmethod
|
|
async def get_speaking_task(self, task_id: int, topic: str, difficulty: str):
|
|
pass
|
|
|
|
@abstractmethod
|
|
async def grade_speaking_task_1_and_2(
|
|
self, task: int, question: str, answer_firebase_path: str, sound_file_name: str
|
|
):
|
|
pass
|
|
|
|
@abstractmethod
|
|
async def grade_speaking_task_3(self, answers: Dict, task: int = 3):
|
|
pass
|
|
|
|
@abstractmethod
|
|
async def create_videos_and_save_to_db(self, exercises: List[Dict], template: Dict, req_id: str):
|
|
pass
|
|
|
|
@abstractmethod
|
|
async def generate_speaking_video(self, original_question: str, topic: str, avatar: str, prompts: List[str]):
|
|
pass
|
|
|
|
@abstractmethod
|
|
async def generate_interactive_video(self, questions: List[str], avatar: str, topic: str):
|
|
pass
|
|
|
|
# ==================================================================================================================
|
|
# Helpers
|
|
# ==================================================================================================================
|
|
|
|
@staticmethod
|
|
@abstractmethod
|
|
def _zero_rating(comment: str):
|
|
pass
|
|
|
|
@staticmethod
|
|
@abstractmethod
|
|
def _calculate_overall(response: Dict):
|
|
pass
|
|
|
|
@abstractmethod
|
|
async def _get_speaking_corrections(self, text):
|
|
pass
|
|
|
|
@abstractmethod
|
|
async def _create_video_per_part(self, exercises: List[Dict], template: Dict, part: int):
|
|
pass
|
|
|
|
@abstractmethod
|
|
async def _create_video(self, question: str, avatar: str, error_message: str):
|
|
pass
|