basyx commited on
Commit
96e90a6
·
verified ·
1 Parent(s): 8fa8304

Create director.py

Browse files
Files changed (1) hide show
  1. utils/director.py +26 -0
utils/director.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ def rewrite_script(words):
2
+ """
3
+ Converts raw transcript → structured viral script
4
+ """
5
+
6
+ text = " ".join([w["text"] for w in words])
7
+
8
+ return {
9
+ "hook": f"Wait—{text[:60]}...",
10
+ "summary": text[:200],
11
+ "emotion": "high" if "!" in text else "medium"
12
+ }
13
+
14
+
15
+ def viral_score(engagement_curve):
16
+ """
17
+ Evaluates full video potential
18
+ """
19
+
20
+ if not engagement_curve:
21
+ return 0
22
+
23
+ peak = max(engagement_curve)
24
+ avg = sum(engagement_curve) / len(engagement_curve)
25
+
26
+ return (peak * 0.7) + (avg * 0.3)