Update sozo_gen.py
Browse files- sozo_gen.py +5 -1
sozo_gen.py
CHANGED
|
@@ -966,10 +966,14 @@ def generate_single_chart(df: pd.DataFrame, description: str, uid: str, project_
|
|
| 966 |
def generate_video_from_project(df: pd.DataFrame, raw_md: str, uid: str, project_id: str, voice_model: str, bucket):
|
| 967 |
logging.info(f"Generating video for project {project_id} with voice {voice_model}")
|
| 968 |
llm = ChatGoogleGenerativeAI(model="gemini-2.0-flash", google_api_key=API_KEY, temperature=0.2)
|
| 969 |
-
|
|
|
|
|
|
|
|
|
|
| 970 |
script = llm.invoke(story_prompt).content
|
| 971 |
scenes = [s.strip() for s in script.split("[SCENE_BREAK]") if s.strip()]
|
| 972 |
video_parts, audio_parts, temps = [], [], []
|
|
|
|
| 973 |
for sc in scenes:
|
| 974 |
descs, narrative = extract_chart_tags(sc), clean_narration(sc)
|
| 975 |
audio_bytes = deepgram_tts(narrative, voice_model)
|
|
|
|
| 966 |
def generate_video_from_project(df: pd.DataFrame, raw_md: str, uid: str, project_id: str, voice_model: str, bucket):
|
| 967 |
logging.info(f"Generating video for project {project_id} with voice {voice_model}")
|
| 968 |
llm = ChatGoogleGenerativeAI(model="gemini-2.0-flash", google_api_key=API_KEY, temperature=0.2)
|
| 969 |
+
|
| 970 |
+
# Modified prompt to output script directly without prefacing
|
| 971 |
+
story_prompt = f"Generate a {VIDEO_SCENES}-scene video script. Each scene must be separated by '[SCENE_BREAK]' and contain narration and one chart tag. Report: {raw_md}"
|
| 972 |
+
|
| 973 |
script = llm.invoke(story_prompt).content
|
| 974 |
scenes = [s.strip() for s in script.split("[SCENE_BREAK]") if s.strip()]
|
| 975 |
video_parts, audio_parts, temps = [], [], []
|
| 976 |
+
|
| 977 |
for sc in scenes:
|
| 978 |
descs, narrative = extract_chart_tags(sc), clean_narration(sc)
|
| 979 |
audio_bytes = deepgram_tts(narrative, voice_model)
|