Fix video generation
This commit is contained in:
@@ -4,5 +4,5 @@ from abc import ABC, abstractmethod
|
||||
class IVideoGeneratorService(ABC):
|
||||
|
||||
@abstractmethod
|
||||
async def create_video(self, text: str, avatar: str):
|
||||
async def create_video(self, text: str, avatar: str, title: str):
|
||||
pass
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import logging
|
||||
import os
|
||||
import random
|
||||
import re
|
||||
import uuid
|
||||
import random
|
||||
from typing import Dict, List, Optional
|
||||
|
||||
from app.repositories.abc import IFileStorage, IDocumentStore
|
||||
from app.services.abc import ISpeakingService, ILLMService, IVideoGeneratorService, ISpeechToTextService
|
||||
from app.configs.constants import (
|
||||
FieldsAndExercises, GPTModels, TemperatureSettings,
|
||||
ELAIAvatars, FilePaths
|
||||
)
|
||||
from app.helpers import TextHelper
|
||||
from app.repositories.abc import IFileStorage, IDocumentStore
|
||||
from app.services.abc import ISpeakingService, ILLMService, IVideoGeneratorService, ISpeechToTextService
|
||||
|
||||
|
||||
class SpeakingService(ISpeakingService):
|
||||
@@ -462,7 +462,8 @@ class SpeakingService(ISpeakingService):
|
||||
result = await self._create_video(
|
||||
exercise["question"],
|
||||
avatar,
|
||||
f'Failed to create video for part {part} question: {str(exercise["question"])}'
|
||||
f'Failed to create video for part {part} question: {str(exercise["question"])}',
|
||||
req_id
|
||||
)
|
||||
if result is not None:
|
||||
template["exercises"][template_index]["prompts"] = exercise["prompts"]
|
||||
@@ -503,7 +504,8 @@ class SpeakingService(ISpeakingService):
|
||||
avatar,
|
||||
'POST - generate_video_{p} - {r} - Failed to create video for part {p} question: {q}'.format(
|
||||
p=part, r=request_id, q=question
|
||||
)
|
||||
),
|
||||
request_id
|
||||
)
|
||||
if result is not None:
|
||||
self._logger.info(f'POST - generate_video_{part} - {request_id} - Video created')
|
||||
|
||||
@@ -14,19 +14,18 @@ class Heygen(IVideoGeneratorService):
|
||||
|
||||
def __init__(self, client: AsyncClient, token: str):
|
||||
pass
|
||||
"""
|
||||
self._get_header = {
|
||||
'X-Api-Key': heygen_token
|
||||
'X-Api-Key': token
|
||||
}
|
||||
self._post_header = {
|
||||
'X-Api-Key': heygen_token,
|
||||
'X-Api-Key': token,
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
self._http_client = client
|
||||
self._logger = logging.getLogger(__name__)
|
||||
"""
|
||||
|
||||
async def create_video(self, text: str, avatar: str, title="video_title": str):
|
||||
|
||||
async def create_video(self, text: str, avatar: str, title="video_title"):
|
||||
pass
|
||||
# POST TO CREATE VIDEO
|
||||
create_video_url = 'https://api.heygen.com/v2/template/' + avatar + '/generate'
|
||||
|
||||
Reference in New Issue
Block a user