Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1342,6 +1342,41 @@ Provide specific revision suggestions with improved examples."""
|
|
1342 |
|
1343 |
return lang_prompts.get(language, lang_prompts["English"])
|
1344 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1345 |
def create_final_reviewer_prompt(self, complete_screenplay: str,
|
1346 |
screenplay_type: str, genre: str, language: str) -> str:
|
1347 |
"""Final comprehensive review"""
|
@@ -1556,6 +1591,54 @@ Provide specific solutions for each issue."""
|
|
1556 |
# For now, returning a placeholder
|
1557 |
return f"Scenes for {act} from the breakdown"
|
1558 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1559 |
# --- LLM call functions ---
|
1560 |
def call_llm_sync(self, messages: List[Dict[str, str]], role: str, language: str) -> str:
|
1561 |
full_content = ""
|
|
|
1342 |
|
1343 |
return lang_prompts.get(language, lang_prompts["English"])
|
1344 |
|
1345 |
+
# โญ ์ฌ๊ธฐ์ ์๋ก์ด ํจ์ ์ถ๊ฐ (๊ธฐ์กด create_script_doctor_prompt ๋ฐ๋ก ์๋)
|
1346 |
+
def create_script_doctor_expansion_prompt(self, act_content: str, act: str,
|
1347 |
+
screenplay_type: str, genre: str,
|
1348 |
+
language: str) -> str:
|
1349 |
+
"""Script doctor prompt focused on expansion and enhancement"""
|
1350 |
+
|
1351 |
+
# Calculate current pages
|
1352 |
+
current_lines = len(act_content.split('\n'))
|
1353 |
+
current_pages = current_lines / 55.0
|
1354 |
+
target_pages = int(SCREENPLAY_LENGTHS[screenplay_type]['pages'] * 0.25)
|
1355 |
+
expansion_needed = target_pages - current_pages
|
1356 |
+
|
1357 |
+
lang_prompts = {
|
1358 |
+
"Korean": f"""๋น์ ์ ์คํฌ๋ฆฝํธ ๋ฅํฐ์
๋๋ค...""",
|
1359 |
+
"English": f"""You are a script doctor..."""
|
1360 |
+
}
|
1361 |
+
|
1362 |
+
return lang_prompts.get(language, lang_prompts["English"])
|
1363 |
+
|
1364 |
+
# โญ create_script_doctor_expansion_prompt ํจ์ ๋ฐ๋ก ์๋์ ์ถ๊ฐ
|
1365 |
+
def create_expansion_writer_prompt(self, act: str, original_content: str,
|
1366 |
+
expansion_notes: str, screenplay_type: str,
|
1367 |
+
language: str) -> str:
|
1368 |
+
"""Writer prompt for expanded version"""
|
1369 |
+
|
1370 |
+
target_pages = int(SCREENPLAY_LENGTHS[screenplay_type]['pages'] * 0.25)
|
1371 |
+
target_lines = target_pages * 55
|
1372 |
+
|
1373 |
+
lang_prompts = {
|
1374 |
+
"Korean": f"""์๋ณธ {act}๋ฅผ ํ์ฅ ์ง์์ฌํญ์ ๋ฐ๋ผ...""",
|
1375 |
+
"English": f"""Rewrite {act} following expansion instructions..."""
|
1376 |
+
}
|
1377 |
+
|
1378 |
+
return lang_prompts.get(language, lang_prompts["English"])
|
1379 |
+
|
1380 |
def create_final_reviewer_prompt(self, complete_screenplay: str,
|
1381 |
screenplay_type: str, genre: str, language: str) -> str:
|
1382 |
"""Final comprehensive review"""
|
|
|
1591 |
# For now, returning a placeholder
|
1592 |
return f"Scenes for {act} from the breakdown"
|
1593 |
|
1594 |
+
|
1595 |
+
# โญ ์ฌ๊ธฐ์ ์๋ก์ด ํจ์ ์ถ๊ฐ (_extract_act_scenes ๊ฐ์ ํฌํผ ๋ฉ์๋๋ค ๊ทผ์ฒ)
|
1596 |
+
def calculate_screenplay_pages(self, content: str) -> float:
|
1597 |
+
"""Calculate screenplay pages more accurately"""
|
1598 |
+
if not content:
|
1599 |
+
return 0.0
|
1600 |
+
|
1601 |
+
lines = content.split('\n')
|
1602 |
+
|
1603 |
+
# Initialize counters
|
1604 |
+
total_line_count = 0
|
1605 |
+
|
1606 |
+
for line in lines:
|
1607 |
+
line = line.strip()
|
1608 |
+
|
1609 |
+
if not line:
|
1610 |
+
# Empty lines count in screenplay format
|
1611 |
+
total_line_count += 1
|
1612 |
+
continue
|
1613 |
+
|
1614 |
+
# Scene heading (INT./EXT.)
|
1615 |
+
if line.startswith(('INT.', 'EXT.')):
|
1616 |
+
total_line_count += 3 # Scene headings take more space
|
1617 |
+
|
1618 |
+
# Character name (all caps, short)
|
1619 |
+
elif line.isupper() and len(line.split()) <= 3 and not any(c.isdigit() for c in line):
|
1620 |
+
total_line_count += 2 # Character names have spacing
|
1621 |
+
|
1622 |
+
# Parenthetical
|
1623 |
+
elif line.startswith('(') and line.endswith(')'):
|
1624 |
+
total_line_count += 1
|
1625 |
+
|
1626 |
+
# Dialogue (indented or after character name)
|
1627 |
+
elif len(line) < 60 and any(prev.isupper() and len(prev.split()) <= 3
|
1628 |
+
for prev in lines[max(0, lines.index(line)-2):lines.index(line)]):
|
1629 |
+
total_line_count += 1
|
1630 |
+
|
1631 |
+
# Action lines
|
1632 |
+
else:
|
1633 |
+
# Long action lines wrap
|
1634 |
+
wrapped_lines = len(line) / 60 # Approximate 60 characters per line
|
1635 |
+
total_line_count += max(1, int(wrapped_lines))
|
1636 |
+
|
1637 |
+
# Standard screenplay format: ~55 lines per page
|
1638 |
+
pages = total_line_count / 55.0
|
1639 |
+
|
1640 |
+
return pages
|
1641 |
+
|
1642 |
# --- LLM call functions ---
|
1643 |
def call_llm_sync(self, messages: List[Dict[str, str]], role: str, language: str) -> str:
|
1644 |
full_content = ""
|