Spaces:
Sleeping
Sleeping
Update sozo_gen.py
Browse files- sozo_gen.py +3 -3
sozo_gen.py
CHANGED
|
@@ -271,7 +271,7 @@ def sanitize_for_firebase_key(text: str) -> str:
|
|
| 271 |
def generate_report_draft(buf, name: str, ctx: str, uid: str, project_id: str, bucket):
|
| 272 |
logging.info(f"Generating report draft for project {project_id}")
|
| 273 |
df = load_dataframe_safely(buf, name)
|
| 274 |
-
llm = ChatGoogleGenerativeAI(model="gemini-
|
| 275 |
ctx_dict = {"shape": df.shape, "columns": list(df.columns), "user_ctx": ctx}
|
| 276 |
enhanced_ctx = enhance_data_context(df, ctx_dict)
|
| 277 |
report_prompt = f"""
|
|
@@ -317,7 +317,7 @@ def generate_report_draft(buf, name: str, ctx: str, uid: str, project_id: str, b
|
|
| 317 |
|
| 318 |
def generate_single_chart(df: pd.DataFrame, description: str, uid: str, project_id: str, bucket):
|
| 319 |
logging.info(f"Generating single chart '{description}' for project {project_id}")
|
| 320 |
-
llm = ChatGoogleGenerativeAI(model="gemini-
|
| 321 |
chart_generator = ChartGenerator(llm, df)
|
| 322 |
with tempfile.NamedTemporaryFile(suffix=".png", delete=False) as temp_file:
|
| 323 |
img_path = Path(temp_file.name)
|
|
@@ -336,7 +336,7 @@ def generate_single_chart(df: pd.DataFrame, description: str, uid: str, project_
|
|
| 336 |
|
| 337 |
def generate_video_from_project(df: pd.DataFrame, raw_md: str, uid: str, project_id: str, voice_model: str, bucket):
|
| 338 |
logging.info(f"Generating video for project {project_id} with voice {voice_model}")
|
| 339 |
-
llm = ChatGoogleGenerativeAI(model="gemini-
|
| 340 |
story_prompt = f"Based on the following report, create a script for a {VIDEO_SCENES}-scene video. Each scene must be separated by '[SCENE_BREAK]' and contain narration and one chart tag. Report: {raw_md}"
|
| 341 |
script = llm.invoke(story_prompt).content
|
| 342 |
scenes = [s.strip() for s in script.split("[SCENE_BREAK]") if s.strip()]
|
|
|
|
| 271 |
def generate_report_draft(buf, name: str, ctx: str, uid: str, project_id: str, bucket):
|
| 272 |
logging.info(f"Generating report draft for project {project_id}")
|
| 273 |
df = load_dataframe_safely(buf, name)
|
| 274 |
+
llm = ChatGoogleGenerativeAI(model="gemini-2.0-flash", google_api_key=API_KEY, temperature=0.1)
|
| 275 |
ctx_dict = {"shape": df.shape, "columns": list(df.columns), "user_ctx": ctx}
|
| 276 |
enhanced_ctx = enhance_data_context(df, ctx_dict)
|
| 277 |
report_prompt = f"""
|
|
|
|
| 317 |
|
| 318 |
def generate_single_chart(df: pd.DataFrame, description: str, uid: str, project_id: str, bucket):
|
| 319 |
logging.info(f"Generating single chart '{description}' for project {project_id}")
|
| 320 |
+
llm = ChatGoogleGenerativeAI(model="gemini-2.0-flash", google_api_key=API_KEY, temperature=0.1)
|
| 321 |
chart_generator = ChartGenerator(llm, df)
|
| 322 |
with tempfile.NamedTemporaryFile(suffix=".png", delete=False) as temp_file:
|
| 323 |
img_path = Path(temp_file.name)
|
|
|
|
| 336 |
|
| 337 |
def generate_video_from_project(df: pd.DataFrame, raw_md: str, uid: str, project_id: str, voice_model: str, bucket):
|
| 338 |
logging.info(f"Generating video for project {project_id} with voice {voice_model}")
|
| 339 |
+
llm = ChatGoogleGenerativeAI(model="gemini-2.0-flash", google_api_key=API_KEY, temperature=0.2)
|
| 340 |
story_prompt = f"Based on the following report, create a script for a {VIDEO_SCENES}-scene video. Each scene must be separated by '[SCENE_BREAK]' and contain narration and one chart tag. Report: {raw_md}"
|
| 341 |
script = llm.invoke(story_prompt).content
|
| 342 |
scenes = [s.strip() for s in script.split("[SCENE_BREAK]") if s.strip()]
|