metaai-sdk 2.3.4__tar.gz → 2.3.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- metaai_sdk-2.3.5/DEPLOYMENT_FIX.md +200 -0
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/PKG-INFO +45 -9
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/QUICK_REFERENCE.md +1 -1
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/QUICK_USAGE.md +14 -4
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/README.md +42 -6
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/final_comprehensive_test.py +1 -1
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/pyproject.toml +2 -2
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/requirements.txt +4 -6
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/src/metaai_api/main.py +154 -32
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/src/metaai_api/video_generation.py +83 -33
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/src/metaai_sdk.egg-info/PKG-INFO +45 -9
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/src/metaai_sdk.egg-info/SOURCES.txt +1 -0
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/src/metaai_sdk.egg-info/requires.txt +2 -2
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/.env.example +0 -0
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/CHANGELOG.md +0 -0
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/CONTRIBUTING.md +0 -0
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/ChatGPT Image Jan 14, 2026, 06_59_02 PM.png +0 -0
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/IMAGE_UPLOAD_README.md +0 -0
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/IMPLEMENTATION_SUMMARY.md +0 -0
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/LICENSE +0 -0
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/MANIFEST.in +0 -0
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/SECURITY.md +0 -0
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/VIDEO_GENERATION_README.md +0 -0
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/analyze_debug_responses.py +0 -0
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/debug_async_video_test.py +0 -0
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/download.jpg +0 -0
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/enable_debug_logging.py +0 -0
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/examples/complete_workflow_example.py +0 -0
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/examples/image_upload_example.py +0 -0
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/examples/image_workflow_complete.py +0 -0
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/examples/practical_use_cases.py +0 -0
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/examples/simple_example.py +0 -0
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/examples/test_example.py +0 -0
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/examples/video_generation.py +0 -0
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/meta_ai_debug.log +0 -0
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/quick_video_test.py +0 -0
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/setup.cfg +0 -0
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/src/metaai_api/__init__.py +0 -0
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/src/metaai_api/api_server.py +0 -0
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/src/metaai_api/client.py +0 -0
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/src/metaai_api/exceptions.py +0 -0
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/src/metaai_api/image_upload.py +0 -0
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/src/metaai_api/utils.py +0 -0
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/src/metaai_sdk.egg-info/dependency_links.txt +0 -0
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/src/metaai_sdk.egg-info/top_level.txt +0 -0
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/test_endpoints.py +0 -0
- {metaai_sdk-2.3.4 → metaai_sdk-2.3.5}/test_image_upload.py +0 -0
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# Deployment Fix: Localhost vs Render Issue
|
|
2
|
+
|
|
3
|
+
## Problem Summary
|
|
4
|
+
|
|
5
|
+
- **Localhost**: ✅ Working perfectly
|
|
6
|
+
- **Render**: ❌ Failed with `ModuleNotFoundError: No module named 'metaai_api.video_generation'`
|
|
7
|
+
|
|
8
|
+
## Root Cause Analysis
|
|
9
|
+
|
|
10
|
+
### What Was Wrong?
|
|
11
|
+
|
|
12
|
+
The issue was **NOT** with package structure or imports. The problem was:
|
|
13
|
+
|
|
14
|
+
1. **Missing API Dependencies on Render**
|
|
15
|
+
- `requirements.txt` had FastAPI/uvicorn **commented out**
|
|
16
|
+
- Render installs from `requirements.txt`, not from pyproject.toml `[api]` extras
|
|
17
|
+
- Without FastAPI installed, the API server couldn't start properly
|
|
18
|
+
|
|
19
|
+
2. **Version Constraints Too Restrictive**
|
|
20
|
+
- `fastapi>=0.95.2,<0.96.0` - Limited to 0.95.x only
|
|
21
|
+
- `uvicorn[standard]>=0.22.0,<0.24.0` - Limited to 0.22.x-0.23.x
|
|
22
|
+
- Modern deployments need flexibility for newer versions
|
|
23
|
+
|
|
24
|
+
### Why Localhost Worked?
|
|
25
|
+
|
|
26
|
+
Your local `.venv` environment already had FastAPI and uvicorn installed (probably from manual installation or previous testing), so everything worked fine when running from source.
|
|
27
|
+
|
|
28
|
+
### Why Render Failed?
|
|
29
|
+
|
|
30
|
+
Render created a fresh environment and only installed dependencies from `requirements.txt`, which had the API server dependencies commented out.
|
|
31
|
+
|
|
32
|
+
## Solutions Applied
|
|
33
|
+
|
|
34
|
+
### 1. ✅ Fixed requirements.txt
|
|
35
|
+
|
|
36
|
+
**Before:**
|
|
37
|
+
|
|
38
|
+
```txt
|
|
39
|
+
# fastapi>=0.95.2,<0.96.0
|
|
40
|
+
# uvicorn[standard]>=0.22.0,<0.24.0
|
|
41
|
+
# python-multipart>=0.0.6
|
|
42
|
+
# python-dotenv>=1.0.0
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**After:**
|
|
46
|
+
|
|
47
|
+
```txt
|
|
48
|
+
fastapi>=0.95.2
|
|
49
|
+
uvicorn[standard]>=0.22.0
|
|
50
|
+
python-dotenv>=1.0.0
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### 2. ✅ Fixed pyproject.toml
|
|
54
|
+
|
|
55
|
+
**Before:**
|
|
56
|
+
|
|
57
|
+
```toml
|
|
58
|
+
api = [
|
|
59
|
+
"fastapi>=0.95.2,<0.96.0",
|
|
60
|
+
"uvicorn[standard]>=0.22.0,<0.24.0",
|
|
61
|
+
]
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**After:**
|
|
65
|
+
|
|
66
|
+
```toml
|
|
67
|
+
api = [
|
|
68
|
+
"fastapi>=0.95.2",
|
|
69
|
+
"uvicorn[standard]>=0.22.0",
|
|
70
|
+
]
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Deployment Steps
|
|
74
|
+
|
|
75
|
+
### 1. Commit and Push Changes
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
git add requirements.txt pyproject.toml
|
|
79
|
+
git commit -m "fix: Uncomment API dependencies for Render deployment"
|
|
80
|
+
git push origin main
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### 2. Render Will Auto-Deploy
|
|
84
|
+
|
|
85
|
+
- Render detects the push
|
|
86
|
+
- Installs dependencies from `requirements.txt`
|
|
87
|
+
- Now includes FastAPI, uvicorn, python-dotenv
|
|
88
|
+
- API server starts successfully
|
|
89
|
+
|
|
90
|
+
### 3. Expected Deployment Log
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
Installing dependencies from requirements.txt...
|
|
94
|
+
Successfully installed fastapi-0.95.2 uvicorn-0.22.0...
|
|
95
|
+
Starting server with uvicorn...
|
|
96
|
+
INFO: Started server process
|
|
97
|
+
INFO: Uvicorn running on http://0.0.0.0:10000
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Verification
|
|
101
|
+
|
|
102
|
+
### Test Deployment Endpoints
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# Health check
|
|
106
|
+
curl https://your-app.onrender.com/
|
|
107
|
+
|
|
108
|
+
# Video generation (async)
|
|
109
|
+
curl -X POST https://your-app.onrender.com/video/async \
|
|
110
|
+
-H "Content-Type: application/json" \
|
|
111
|
+
-d '{"prompt": "a cat playing piano"}'
|
|
112
|
+
|
|
113
|
+
# Check job status
|
|
114
|
+
curl https://your-app.onrender.com/video/jobs/{job_id}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Additional Notes
|
|
118
|
+
|
|
119
|
+
### Package Structure (Confirmed Working)
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
dist/metaai_sdk-2.2.1-py3-none-any.whl
|
|
123
|
+
├── metaai_api/
|
|
124
|
+
│ ├── __init__.py ✅ Imports VideoGenerator
|
|
125
|
+
│ ├── main.py ✅ Core MetaAI class
|
|
126
|
+
│ ├── video_generation.py ✅ Included in package
|
|
127
|
+
│ ├── api_server.py ✅ FastAPI endpoints
|
|
128
|
+
│ ├── client.py
|
|
129
|
+
│ ├── image_upload.py
|
|
130
|
+
│ └── utils.py
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Environment Differences
|
|
134
|
+
|
|
135
|
+
| Aspect | Localhost | Render (Before Fix) | Render (After Fix) |
|
|
136
|
+
| ------------------- | ----------------- | --------------------------------- | --------------------------------- |
|
|
137
|
+
| Source Location | `src/metaai_api/` | `.venv/site-packages/metaai_api/` | `.venv/site-packages/metaai_api/` |
|
|
138
|
+
| FastAPI Installed | ✅ Yes (manual) | ❌ No (commented) | ✅ Yes (requirements.txt) |
|
|
139
|
+
| video_generation.py | ✅ Present | ✅ Present | ✅ Present |
|
|
140
|
+
| API Server Starts | ✅ Yes | ❌ No | ✅ Yes |
|
|
141
|
+
|
|
142
|
+
## Common Pitfalls to Avoid
|
|
143
|
+
|
|
144
|
+
1. **Don't rely on optional dependencies in production**
|
|
145
|
+
- Use `requirements.txt` for deployment dependencies
|
|
146
|
+
- Use `pyproject.toml [api]` for development/pip install options
|
|
147
|
+
|
|
148
|
+
2. **Version constraints**
|
|
149
|
+
- Avoid upper bounds (`<0.96.0`) unless necessary
|
|
150
|
+
- Allow patch version flexibility
|
|
151
|
+
- Test with latest versions periodically
|
|
152
|
+
|
|
153
|
+
3. **Dependency conflicts**
|
|
154
|
+
- `python-multipart` was listed in both main and [api] dependencies
|
|
155
|
+
- Keep in main dependencies since FastAPI requires it
|
|
156
|
+
|
|
157
|
+
## Troubleshooting
|
|
158
|
+
|
|
159
|
+
### If deployment still fails:
|
|
160
|
+
|
|
161
|
+
1. **Check Render logs for import errors:**
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
ModuleNotFoundError: No module named 'fastapi'
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
→ Verify requirements.txt is uncommented
|
|
168
|
+
|
|
169
|
+
2. **Check for version conflicts:**
|
|
170
|
+
|
|
171
|
+
```
|
|
172
|
+
ERROR: ResolutionImpossible
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
→ Remove upper version bounds from pyproject.toml
|
|
176
|
+
|
|
177
|
+
3. **Check Python version:**
|
|
178
|
+
- Render uses Python 3.13 (from logs)
|
|
179
|
+
- Minimum required: Python 3.7
|
|
180
|
+
- All dependencies compatible: ✅
|
|
181
|
+
|
|
182
|
+
## Success Criteria
|
|
183
|
+
|
|
184
|
+
✅ Render build succeeds without errors
|
|
185
|
+
✅ Server starts with uvicorn
|
|
186
|
+
✅ All 8 API endpoints respond
|
|
187
|
+
✅ Video generation works with job tracking
|
|
188
|
+
✅ No ModuleNotFoundError in logs
|
|
189
|
+
|
|
190
|
+
## Files Modified
|
|
191
|
+
|
|
192
|
+
- `requirements.txt` - Uncommented FastAPI, uvicorn, python-dotenv
|
|
193
|
+
- `pyproject.toml` - Removed restrictive version upper bounds
|
|
194
|
+
- `DEPLOYMENT_FIX.md` - This documentation (created)
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
**Status**: 🎉 **READY FOR DEPLOYMENT**
|
|
199
|
+
|
|
200
|
+
Push changes to trigger Render auto-deploy. Your API server will work on Render exactly as it does on localhost.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: metaai-sdk
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.5
|
|
4
4
|
Summary: Feature-rich Python SDK for Meta AI - Chat, Image & Video Generation powered by Llama 3
|
|
5
5
|
Author-email: Ashiq Hussain Mir <imseldrith@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -27,8 +27,8 @@ Requires-Dist: lxml-html-clean>=0.1.1
|
|
|
27
27
|
Requires-Dist: beautifulsoup4>=4.9.0
|
|
28
28
|
Requires-Dist: python-multipart>=0.0.21
|
|
29
29
|
Provides-Extra: api
|
|
30
|
-
Requires-Dist: fastapi
|
|
31
|
-
Requires-Dist: uvicorn[standard]
|
|
30
|
+
Requires-Dist: fastapi>=0.95.2; extra == "api"
|
|
31
|
+
Requires-Dist: uvicorn[standard]>=0.22.0; extra == "api"
|
|
32
32
|
Requires-Dist: python-multipart>=0.0.6; extra == "api"
|
|
33
33
|
Requires-Dist: python-dotenv>=1.0.0; extra == "api"
|
|
34
34
|
Provides-Extra: dev
|
|
@@ -487,22 +487,29 @@ print(f"\n🎉 Generated {len(videos)} videos successfully!")
|
|
|
487
487
|
🎉 Generated 3 videos successfully!
|
|
488
488
|
```
|
|
489
489
|
|
|
490
|
-
### Example 3: Advanced Video Generation
|
|
490
|
+
### Example 3: Advanced Video Generation with Orientation
|
|
491
491
|
|
|
492
492
|
```python
|
|
493
493
|
from metaai_api import MetaAI
|
|
494
494
|
|
|
495
495
|
ai = MetaAI(cookies=cookies)
|
|
496
496
|
|
|
497
|
-
#
|
|
497
|
+
# Generate video with specific orientation (default is VERTICAL)
|
|
498
498
|
result = ai.generate_video(
|
|
499
499
|
prompt="A time-lapse of a flower blooming",
|
|
500
|
+
orientation="VERTICAL", # Options: "LANDSCAPE", "VERTICAL", "SQUARE"
|
|
500
501
|
wait_before_poll=15, # Wait 15 seconds before checking
|
|
501
502
|
max_attempts=50, # Try up to 50 times
|
|
502
503
|
wait_seconds=3, # Wait 3 seconds between attempts
|
|
503
504
|
verbose=True # Show detailed progress
|
|
504
505
|
)
|
|
505
506
|
|
|
507
|
+
# Generate landscape video for widescreen
|
|
508
|
+
result_landscape = ai.generate_video(
|
|
509
|
+
prompt="Panoramic view of sunset over mountains",
|
|
510
|
+
orientation="LANDSCAPE" # Wide format (16:9)
|
|
511
|
+
)
|
|
512
|
+
|
|
506
513
|
if result["success"]:
|
|
507
514
|
print(f"\n🎬 Your videos are ready!")
|
|
508
515
|
print(f"🔗 Generated {len(result['video_urls'])} videos:")
|
|
@@ -511,6 +518,14 @@ if result["success"]:
|
|
|
511
518
|
print(f"⏱️ Generated at: {result['timestamp']}")
|
|
512
519
|
```
|
|
513
520
|
|
|
521
|
+
**Supported Video Orientations:**
|
|
522
|
+
|
|
523
|
+
- `"LANDSCAPE"` - Wide/horizontal (16:9) - ideal for widescreen, cinematic content
|
|
524
|
+
- `"VERTICAL"` - Tall/vertical (9:16) - ideal for mobile, stories, reels (default)
|
|
525
|
+
- `"SQUARE"` - Equal dimensions (1:1) - ideal for social posts
|
|
526
|
+
|
|
527
|
+
````
|
|
528
|
+
|
|
514
529
|
📖 **Full Video Guide:** See [VIDEO_GENERATION_README.md](https://github.com/mir-ashiq/metaai-api/blob/main/VIDEO_GENERATION_README.md) for complete documentation!
|
|
515
530
|
|
|
516
531
|
---
|
|
@@ -565,7 +580,7 @@ if result["success"]:
|
|
|
565
580
|
)
|
|
566
581
|
if video["success"]:
|
|
567
582
|
print(f"🎬 Video: {video['video_urls'][0]}")
|
|
568
|
-
|
|
583
|
+
````
|
|
569
584
|
|
|
570
585
|
**Output:**
|
|
571
586
|
|
|
@@ -583,7 +598,7 @@ if result["success"]:
|
|
|
583
598
|
|
|
584
599
|
## 🎨 Image Generation
|
|
585
600
|
|
|
586
|
-
Generate AI-powered images (requires Facebook authentication):
|
|
601
|
+
Generate AI-powered images with customizable orientations (requires Facebook authentication):
|
|
587
602
|
|
|
588
603
|
```python
|
|
589
604
|
from metaai_api import MetaAI
|
|
@@ -591,9 +606,25 @@ from metaai_api import MetaAI
|
|
|
591
606
|
# Initialize with Facebook credentials
|
|
592
607
|
ai = MetaAI(fb_email="your_email@example.com", fb_password="your_password")
|
|
593
608
|
|
|
594
|
-
# Generate images
|
|
609
|
+
# Generate images with default orientation (VERTICAL)
|
|
595
610
|
response = ai.prompt("Generate an image of a cyberpunk cityscape at night with neon lights")
|
|
596
611
|
|
|
612
|
+
# Or specify orientation explicitly
|
|
613
|
+
response_landscape = ai.prompt(
|
|
614
|
+
"Generate an image of a panoramic mountain landscape",
|
|
615
|
+
orientation="LANDSCAPE" # Options: "LANDSCAPE", "VERTICAL", "SQUARE"
|
|
616
|
+
)
|
|
617
|
+
|
|
618
|
+
response_vertical = ai.prompt(
|
|
619
|
+
"Generate an image of a tall waterfall",
|
|
620
|
+
orientation="VERTICAL" # Tall/portrait format (default)
|
|
621
|
+
)
|
|
622
|
+
|
|
623
|
+
response_square = ai.prompt(
|
|
624
|
+
"Generate an image of a centered mandala pattern",
|
|
625
|
+
orientation="SQUARE" # Square format (1:1)
|
|
626
|
+
)
|
|
627
|
+
|
|
597
628
|
# Display results (Meta AI generates 4 images by default)
|
|
598
629
|
print(f"🎨 Generated {len(response['media'])} images:")
|
|
599
630
|
for i, image in enumerate(response['media'], 1):
|
|
@@ -601,6 +632,12 @@ for i, image in enumerate(response['media'], 1):
|
|
|
601
632
|
print(f" Prompt: {image['prompt']}")
|
|
602
633
|
```
|
|
603
634
|
|
|
635
|
+
**Supported Orientations:**
|
|
636
|
+
|
|
637
|
+
- `"LANDSCAPE"` - Wide/horizontal format (16:9) - ideal for panoramas, landscapes
|
|
638
|
+
- `"VERTICAL"` - Tall/vertical format (9:16) - ideal for portraits, mobile content (default)
|
|
639
|
+
- `"SQUARE"` - Equal dimensions (1:1) - ideal for social media, profile images
|
|
640
|
+
|
|
604
641
|
**Output:**
|
|
605
642
|
|
|
606
643
|
```
|
|
@@ -680,7 +717,6 @@ class MetaAI:
|
|
|
680
717
|
**Methods:**
|
|
681
718
|
|
|
682
719
|
- **`prompt(message, stream=False, new_conversation=False)`**
|
|
683
|
-
|
|
684
720
|
- Send a chat message
|
|
685
721
|
- Returns: `dict` with `message`, `sources`, and `media`
|
|
686
722
|
|
|
@@ -223,7 +223,7 @@ except Exception as e:
|
|
|
223
223
|
## 🔗 Links
|
|
224
224
|
|
|
225
225
|
- **GitHub**: [mir-ashiq/meta-ai-python](https://github.com/mir-ashiq/metaai-api)
|
|
226
|
-
- **PyPI**: [metaai-
|
|
226
|
+
- **PyPI**: [metaai-sdk](https://pypi.org/project/metaai-sdk/)
|
|
227
227
|
- **Documentation**: [README.md](README.md)
|
|
228
228
|
- **Changelog**: [CHANGELOG.md](CHANGELOG.md)
|
|
229
229
|
- **Meta AI**: https://www.meta.ai/
|
|
@@ -16,13 +16,23 @@ metadata = {'file_size': result['file_size'], 'mime_type': result['mime_type']}
|
|
|
16
16
|
response = ai.prompt("What's in this image?", media_ids=[media_id], attachment_metadata=metadata)
|
|
17
17
|
print(response["message"])
|
|
18
18
|
|
|
19
|
-
# 3. Generate Similar Images
|
|
20
|
-
response = ai.prompt(
|
|
19
|
+
# 3. Generate Similar Images with orientation
|
|
20
|
+
response = ai.prompt(
|
|
21
|
+
"Create similar in anime style",
|
|
22
|
+
media_ids=[media_id],
|
|
23
|
+
attachment_metadata=metadata,
|
|
24
|
+
orientation="VERTICAL" # Options: "LANDSCAPE", "VERTICAL" (default), "SQUARE"
|
|
25
|
+
)
|
|
21
26
|
for img in response["media"]:
|
|
22
27
|
print(img["url"])
|
|
23
28
|
|
|
24
|
-
# 4. Generate Video
|
|
25
|
-
video = ai.generate_video(
|
|
29
|
+
# 4. Generate Video with orientation
|
|
30
|
+
video = ai.generate_video(
|
|
31
|
+
"animate with cinematic motion",
|
|
32
|
+
media_ids=[media_id],
|
|
33
|
+
attachment_metadata=metadata,
|
|
34
|
+
orientation="LANDSCAPE" # Wide format for cinematic effect
|
|
35
|
+
)
|
|
26
36
|
print(video["video_urls"][0])
|
|
27
37
|
```
|
|
28
38
|
|
|
@@ -447,22 +447,29 @@ print(f"\n🎉 Generated {len(videos)} videos successfully!")
|
|
|
447
447
|
🎉 Generated 3 videos successfully!
|
|
448
448
|
```
|
|
449
449
|
|
|
450
|
-
### Example 3: Advanced Video Generation
|
|
450
|
+
### Example 3: Advanced Video Generation with Orientation
|
|
451
451
|
|
|
452
452
|
```python
|
|
453
453
|
from metaai_api import MetaAI
|
|
454
454
|
|
|
455
455
|
ai = MetaAI(cookies=cookies)
|
|
456
456
|
|
|
457
|
-
#
|
|
457
|
+
# Generate video with specific orientation (default is VERTICAL)
|
|
458
458
|
result = ai.generate_video(
|
|
459
459
|
prompt="A time-lapse of a flower blooming",
|
|
460
|
+
orientation="VERTICAL", # Options: "LANDSCAPE", "VERTICAL", "SQUARE"
|
|
460
461
|
wait_before_poll=15, # Wait 15 seconds before checking
|
|
461
462
|
max_attempts=50, # Try up to 50 times
|
|
462
463
|
wait_seconds=3, # Wait 3 seconds between attempts
|
|
463
464
|
verbose=True # Show detailed progress
|
|
464
465
|
)
|
|
465
466
|
|
|
467
|
+
# Generate landscape video for widescreen
|
|
468
|
+
result_landscape = ai.generate_video(
|
|
469
|
+
prompt="Panoramic view of sunset over mountains",
|
|
470
|
+
orientation="LANDSCAPE" # Wide format (16:9)
|
|
471
|
+
)
|
|
472
|
+
|
|
466
473
|
if result["success"]:
|
|
467
474
|
print(f"\n🎬 Your videos are ready!")
|
|
468
475
|
print(f"🔗 Generated {len(result['video_urls'])} videos:")
|
|
@@ -471,6 +478,14 @@ if result["success"]:
|
|
|
471
478
|
print(f"⏱️ Generated at: {result['timestamp']}")
|
|
472
479
|
```
|
|
473
480
|
|
|
481
|
+
**Supported Video Orientations:**
|
|
482
|
+
|
|
483
|
+
- `"LANDSCAPE"` - Wide/horizontal (16:9) - ideal for widescreen, cinematic content
|
|
484
|
+
- `"VERTICAL"` - Tall/vertical (9:16) - ideal for mobile, stories, reels (default)
|
|
485
|
+
- `"SQUARE"` - Equal dimensions (1:1) - ideal for social posts
|
|
486
|
+
|
|
487
|
+
````
|
|
488
|
+
|
|
474
489
|
📖 **Full Video Guide:** See [VIDEO_GENERATION_README.md](https://github.com/mir-ashiq/metaai-api/blob/main/VIDEO_GENERATION_README.md) for complete documentation!
|
|
475
490
|
|
|
476
491
|
---
|
|
@@ -525,7 +540,7 @@ if result["success"]:
|
|
|
525
540
|
)
|
|
526
541
|
if video["success"]:
|
|
527
542
|
print(f"🎬 Video: {video['video_urls'][0]}")
|
|
528
|
-
|
|
543
|
+
````
|
|
529
544
|
|
|
530
545
|
**Output:**
|
|
531
546
|
|
|
@@ -543,7 +558,7 @@ if result["success"]:
|
|
|
543
558
|
|
|
544
559
|
## 🎨 Image Generation
|
|
545
560
|
|
|
546
|
-
Generate AI-powered images (requires Facebook authentication):
|
|
561
|
+
Generate AI-powered images with customizable orientations (requires Facebook authentication):
|
|
547
562
|
|
|
548
563
|
```python
|
|
549
564
|
from metaai_api import MetaAI
|
|
@@ -551,9 +566,25 @@ from metaai_api import MetaAI
|
|
|
551
566
|
# Initialize with Facebook credentials
|
|
552
567
|
ai = MetaAI(fb_email="your_email@example.com", fb_password="your_password")
|
|
553
568
|
|
|
554
|
-
# Generate images
|
|
569
|
+
# Generate images with default orientation (VERTICAL)
|
|
555
570
|
response = ai.prompt("Generate an image of a cyberpunk cityscape at night with neon lights")
|
|
556
571
|
|
|
572
|
+
# Or specify orientation explicitly
|
|
573
|
+
response_landscape = ai.prompt(
|
|
574
|
+
"Generate an image of a panoramic mountain landscape",
|
|
575
|
+
orientation="LANDSCAPE" # Options: "LANDSCAPE", "VERTICAL", "SQUARE"
|
|
576
|
+
)
|
|
577
|
+
|
|
578
|
+
response_vertical = ai.prompt(
|
|
579
|
+
"Generate an image of a tall waterfall",
|
|
580
|
+
orientation="VERTICAL" # Tall/portrait format (default)
|
|
581
|
+
)
|
|
582
|
+
|
|
583
|
+
response_square = ai.prompt(
|
|
584
|
+
"Generate an image of a centered mandala pattern",
|
|
585
|
+
orientation="SQUARE" # Square format (1:1)
|
|
586
|
+
)
|
|
587
|
+
|
|
557
588
|
# Display results (Meta AI generates 4 images by default)
|
|
558
589
|
print(f"🎨 Generated {len(response['media'])} images:")
|
|
559
590
|
for i, image in enumerate(response['media'], 1):
|
|
@@ -561,6 +592,12 @@ for i, image in enumerate(response['media'], 1):
|
|
|
561
592
|
print(f" Prompt: {image['prompt']}")
|
|
562
593
|
```
|
|
563
594
|
|
|
595
|
+
**Supported Orientations:**
|
|
596
|
+
|
|
597
|
+
- `"LANDSCAPE"` - Wide/horizontal format (16:9) - ideal for panoramas, landscapes
|
|
598
|
+
- `"VERTICAL"` - Tall/vertical format (9:16) - ideal for portraits, mobile content (default)
|
|
599
|
+
- `"SQUARE"` - Equal dimensions (1:1) - ideal for social media, profile images
|
|
600
|
+
|
|
564
601
|
**Output:**
|
|
565
602
|
|
|
566
603
|
```
|
|
@@ -640,7 +677,6 @@ class MetaAI:
|
|
|
640
677
|
**Methods:**
|
|
641
678
|
|
|
642
679
|
- **`prompt(message, stream=False, new_conversation=False)`**
|
|
643
|
-
|
|
644
680
|
- Send a chat message
|
|
645
681
|
- Returns: `dict` with `message`, `sources`, and `media`
|
|
646
682
|
|
|
@@ -38,8 +38,8 @@ Changelog = "https://github.com/mir-ashiq/metaai-api/blob/main/CHANGELOG.md"
|
|
|
38
38
|
|
|
39
39
|
[project.optional-dependencies]
|
|
40
40
|
api = [
|
|
41
|
-
"fastapi>=0.95.2
|
|
42
|
-
"uvicorn[standard]>=0.22.0
|
|
41
|
+
"fastapi>=0.95.2",
|
|
42
|
+
"uvicorn[standard]>=0.22.0",
|
|
43
43
|
"python-multipart>=0.0.6",
|
|
44
44
|
"python-dotenv>=1.0.0",
|
|
45
45
|
]
|
|
@@ -7,12 +7,10 @@ requests-html>=0.10.0
|
|
|
7
7
|
lxml-html-clean>=0.1.1
|
|
8
8
|
beautifulsoup4>=4.9.0
|
|
9
9
|
|
|
10
|
-
# API Server dependencies (
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
# python-multipart>=0.0.6
|
|
15
|
-
# python-dotenv>=1.0.0
|
|
10
|
+
# API Server dependencies (required for deployment)
|
|
11
|
+
fastapi>=0.95.2
|
|
12
|
+
uvicorn[standard]>=0.22.0
|
|
13
|
+
python-dotenv>=1.0.0
|
|
16
14
|
|
|
17
15
|
# Optional: Development dependencies
|
|
18
16
|
# Install with: pip install -e ".[dev]"
|