Avatar's can't be random on the video endpoint since these will be called in batch
This commit is contained in:
@@ -16,7 +16,7 @@ speaking_router = APIRouter()
|
|||||||
|
|
||||||
class Video(BaseModel):
|
class Video(BaseModel):
|
||||||
text: str
|
text: str
|
||||||
avatar: Optional[str] = None
|
avatar: str
|
||||||
|
|
||||||
@speaking_router.post(
|
@speaking_router.post(
|
||||||
'/media',
|
'/media',
|
||||||
@@ -75,13 +75,3 @@ async def get_speaking_task(
|
|||||||
|
|
||||||
second_topic = second_topic if second_topic else random.choice(EducationalContent.MTI_TOPICS)
|
second_topic = second_topic if second_topic else random.choice(EducationalContent.MTI_TOPICS)
|
||||||
return await speaking_controller.get_speaking_part(task, topic_or_first_topic, second_topic, difficulty)
|
return await speaking_controller.get_speaking_part(task, topic_or_first_topic, second_topic, difficulty)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
"""
|
|
||||||
async def generate_video(self, text: str, avatar: str):
|
|
||||||
return await self._vid_gen.create_video(text, avatar)
|
|
||||||
|
|
||||||
async def pool_video(self, vid_id: str):
|
|
||||||
return await self._vid_gen.pool_status(vid_id)
|
|
||||||
"""
|
|
||||||
@@ -15,7 +15,7 @@ class ISpeakingController(ABC):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
async def generate_video(self, text: str, avatar: Optional[str]):
|
async def generate_video(self, text: str, avatar: str):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class SpeakingController(ISpeakingController):
|
|||||||
async def get_avatars(self):
|
async def get_avatars(self):
|
||||||
return await self._vid_gen.get_avatars()
|
return await self._vid_gen.get_avatars()
|
||||||
|
|
||||||
async def generate_video(self, text: str, avatar: Optional[str]):
|
async def generate_video(self, text: str, avatar: str):
|
||||||
return await self._vid_gen.create_video(text, avatar)
|
return await self._vid_gen.create_video(text, avatar)
|
||||||
|
|
||||||
async def pool_video(self, vid_id: str):
|
async def pool_video(self, vid_id: str):
|
||||||
|
|||||||
@@ -29,11 +29,6 @@ class Heygen(IVideoGeneratorService):
|
|||||||
self._logger = logging.getLogger(__name__)
|
self._logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
async def create_video(self, text: str, avatar: str):
|
async def create_video(self, text: str, avatar: str):
|
||||||
if not avatar:
|
|
||||||
random_avatar_name = random.choice(list(self._avatars.keys()))
|
|
||||||
avatar = self._avatars[random_avatar_name]["id"]
|
|
||||||
#["id"]
|
|
||||||
else:
|
|
||||||
avatar = self._avatars[avatar]["id"]
|
avatar = self._avatars[avatar]["id"]
|
||||||
|
|
||||||
create_video_url = f'https://api.heygen.com/v2/template/{avatar}/generate'
|
create_video_url = f'https://api.heygen.com/v2/template/{avatar}/generate'
|
||||||
|
|||||||
Reference in New Issue
Block a user