File size: 2,468 Bytes
29095e4
5479abf
29095e4
 
5479abf
 
 
 
 
 
 
29095e4
 
5479abf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
---
license: gemma
library_name: transformers
tags:
- gemma
- video-production
- automation
- viral-content
- function-calling
base_model: google/functiongemma-270m-it
pipeline_tag: text-generation
---

# 🎬 FunctionGemma-Director-V1

**FunctionGemma-Director-V1** is a specialized lightweight AI model (270M parameters) designed to automate the production of viral short-form gaming videos (TikTok/Shorts/Reels).

It acts as a **"Creative Director"**, converting a simple video title into a structured **JSON editing plan**, executing a "Trojan Horse" monetization strategy by seamlessly integrating CPA offers into content.

## 🚀 Key Features
*   **Size:** ~540MB (Runs smoothly on free Colab/CPU).
*   **Strategy:** Automatically places "High Retention Hooks" and injects "CPA Offers" at the most effective timestamps.
*   **Output:** Strict JSON format compatible with Python video automation engines (MoviePy).

## 💻 How to Use

```python
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
import json

# 1. Load the Model
model_id = "Saad4web/FunctionGemma-Director-V1"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
    model_id, 
    device_map="auto", 
    torch_dtype=torch.float16 # Optimized for low memory
)

# 2. Define the Tools (The Model's Vocabulary)
tools_schema = [
    {"name": "add_video_clip", "parameters": {"file_path": "string", "duration": "number"}},
    {"name": "add_text_overlay", "parameters": {"text": "string", "color": "string"}},
]

# 3. Create the Prompt
video_title = "TOP 3|SCARIEST HORROR GAMES|*DONT WATCH ALONE*"
system_msg = f"You are a specialized video editor AI. Available tools: {json.dumps(tools_schema)}"
messages = [{"role": "user", "content": system_msg + f"\n\nCreate a viral video plan for: {video_title}"}]

# 4. Generate the Plan
input_ids = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)

outputs = model.generate(
    input_ids, 
    max_new_tokens=512, 
    do_sample=True, 
    temperature=0.1
)

# 5. Get the JSON
plan = tokenizer.decode(outputs[0][len(input_ids[0]):], skip_special_tokens=True)
print(plan)

#🛠️ Training Details
    Architecture: Fine-tuned google/functiongemma-270m-it.
    Dataset: Synthetic dataset generated via Knowledge Distillation (Teacher: GPT-4o/Gemini 2.0).
    Method: Full Fine-Tuning using LLaMA Factory.
    Created by [Saad4web]