gokaygokay commited on
Commit
9499f0c
·
1 Parent(s): 1e26e1c

fix models

Browse files
Files changed (2) hide show
  1. app.py +7 -1
  2. llm_inference_video.py +38 -9
app.py CHANGED
@@ -59,6 +59,11 @@ def create_video_interface():
59
  value="Meta-Llama-3.1-70B-Instruct",
60
  label="Model"
61
  )
 
 
 
 
 
62
 
63
  generate_btn = gr.Button("Generate Video Prompt", variant="primary")
64
  output = gr.Textbox(label="Generated Prompt", lines=12, show_copy_button=True)
@@ -78,7 +83,8 @@ def create_video_interface():
78
 
79
  generate_btn.click(
80
  llm_node.generate_video_prompt,
81
- inputs=[input_concept, style, camera_style, pacing, special_effects, custom_elements, provider, model],
 
82
  outputs=output
83
  )
84
 
 
59
  value="Meta-Llama-3.1-70B-Instruct",
60
  label="Model"
61
  )
62
+ prompt_length = gr.Dropdown(
63
+ choices=["Short", "Medium", "Long"],
64
+ value="Medium",
65
+ label="Prompt Length"
66
+ )
67
 
68
  generate_btn = gr.Button("Generate Video Prompt", variant="primary")
69
  output = gr.Textbox(label="Generated Prompt", lines=12, show_copy_button=True)
 
83
 
84
  generate_btn.click(
85
  llm_node.generate_video_prompt,
86
+ inputs=[input_concept, style, camera_style, pacing, special_effects,
87
+ custom_elements, provider, model, prompt_length],
88
  outputs=output
89
  )
90
 
llm_inference_video.py CHANGED
@@ -24,7 +24,8 @@ class VideoLLMInferenceNode:
24
  special_effects,
25
  custom_elements,
26
  provider="SambaNova",
27
- model=None
 
28
  ):
29
  try:
30
  # Video prompt templates
@@ -42,13 +43,42 @@ class VideoLLMInferenceNode:
42
  }
43
 
44
  base_prompt = prompt_templates.get(style.lower(), prompt_templates["cinematic"])
45
- system_message = """You are a visionary video director and creative storyteller. Create a single, richly detailed paragraph that paints a complete picture of the video concept. Focus on:
46
- 1. Overall visual atmosphere and mood
47
- 2. Narrative flow and story progression
48
- 3. Distinctive visual style and aesthetic choices
49
- 4. Key moments and visual highlights
50
- 5. Emotional impact and audience experience
51
- Avoid technical specifications or shot-by-shot breakdowns. Instead, create a flowing, descriptive narrative that captures the essence of the video."""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
 
53
  # Select provider
54
  if provider == "Groq":
@@ -65,7 +95,6 @@ Avoid technical specifications or shot-by-shot breakdowns. Instead, create a flo
65
  {"role": "user", "content": f"{base_prompt}\nCore Concept: {input_concept}"}
66
  ],
67
  temperature=1.2,
68
- max_tokens=1500,
69
  top_p=0.95,
70
  seed=random.randint(0, 10000)
71
  )
 
24
  special_effects,
25
  custom_elements,
26
  provider="SambaNova",
27
+ model=None,
28
+ prompt_length="Medium"
29
  ):
30
  try:
31
  # Video prompt templates
 
43
  }
44
 
45
  base_prompt = prompt_templates.get(style.lower(), prompt_templates["cinematic"])
46
+
47
+ # Configure length requirements
48
+ length_config = {
49
+ "Short": {
50
+ "guidance": "Create exactly ONE impactful sentence that captures the essence of the video. Be concise but descriptive.",
51
+ "structure": "Combine all elements into a single, powerful sentence."
52
+ },
53
+ "Medium": {
54
+ "guidance": "Create 2-3 flowing sentences that paint a picture of the video.",
55
+ "structure": "First sentence should set the scene, followed by 1-2 sentences developing the concept."
56
+ },
57
+ "Long": {
58
+ "guidance": "Create 4-5 detailed sentences that thoroughly describe the video.",
59
+ "structure": "Begin with the setting, develop the action/movement, and conclude with impact."
60
+ }
61
+ }
62
+
63
+ config = length_config[prompt_length]
64
+
65
+ system_message = f"""You are a visionary video director and creative storyteller. {config['guidance']}
66
+
67
+ Structure: {config['structure']}
68
+
69
+ Focus on these elements while maintaining the specified sentence count:
70
+ 1. Visual atmosphere and mood
71
+ 2. Narrative flow
72
+ 3. Style and aesthetic choices
73
+ 4. Key moments
74
+ 5. Emotional impact
75
+
76
+ Important: Deliver exactly the specified number of sentences:
77
+ - Short: ONE sentence
78
+ - Medium: TWO to THREE sentences
79
+ - Long: FOUR to FIVE sentences
80
+
81
+ Keep everything in a single paragraph format. Avoid technical specifications or shot lists."""
82
 
83
  # Select provider
84
  if provider == "Groq":
 
95
  {"role": "user", "content": f"{base_prompt}\nCore Concept: {input_concept}"}
96
  ],
97
  temperature=1.2,
 
98
  top_p=0.95,
99
  seed=random.randint(0, 10000)
100
  )