Commit Β·
71b3815
1
Parent(s): 5915f7c
Update category matching to 4 types: Ai BF, Ai GF, Ai Hug Video, Ai Kiss Video
Browse files- README.md +7 -5
- main.py +6 -4
- services/mongodb_service.py +7 -2
README.md
CHANGED
|
@@ -98,14 +98,16 @@ Response:
|
|
| 98 |
**Form Data:**
|
| 99 |
- `image`: Image file (JPG, PNG, WebP)
|
| 100 |
- `user_id`: User ID string (optional)
|
| 101 |
-
- `prompt_text`: Prompt text for video generation (must contain
|
| 102 |
- `firebase_id_token`: Firebase ID token
|
| 103 |
- `appname`: App name for database routing (optional)
|
| 104 |
|
| 105 |
-
**Category Matching:**
|
| 106 |
-
The prompt_text is automatically matched to categories:
|
| 107 |
-
- Contains "kiss" β
|
| 108 |
-
- Contains "hug" β
|
|
|
|
|
|
|
| 109 |
|
| 110 |
**Success Response:**
|
| 111 |
```json
|
|
|
|
| 98 |
**Form Data:**
|
| 99 |
- `image`: Image file (JPG, PNG, WebP)
|
| 100 |
- `user_id`: User ID string (optional)
|
| 101 |
+
- `prompt_text`: Prompt text for video generation (must contain keywords to match category)
|
| 102 |
- `firebase_id_token`: Firebase ID token
|
| 103 |
- `appname`: App name for database routing (optional)
|
| 104 |
|
| 105 |
+
**Category Matching (4 video types):**
|
| 106 |
+
The prompt_text is automatically matched to one of 4 categories:
|
| 107 |
+
- Contains "kiss" β Ai Kiss Video
|
| 108 |
+
- Contains "hug" β Ai Hug Video
|
| 109 |
+
- Contains "bf" or "boyfriend" β Ai BF
|
| 110 |
+
- Contains "gf" or "girlfriend" β Ai GF
|
| 111 |
|
| 112 |
**Success Response:**
|
| 113 |
```json
|
main.py
CHANGED
|
@@ -131,7 +131,7 @@ async def get_firebase_user(
|
|
| 131 |
async def generate_video(
|
| 132 |
image: UploadFile = File(..., description="User image file (JPG, PNG, WebP)"),
|
| 133 |
user_id: Optional[str] = Form(None, description="User ID (ObjectId string or integer)"),
|
| 134 |
-
prompt_text: str = Form(..., description="Prompt text for video generation (must contain
|
| 135 |
firebase_id_token: str = Form(..., description="Firebase ID token"),
|
| 136 |
appname: Optional[str] = Form(None, description="App name for database routing (collage-maker, AI-Enhancer, etc.)"),
|
| 137 |
authorization: Optional[str] = Header(None, description="HF Token as Bearer token")
|
|
@@ -142,14 +142,16 @@ async def generate_video(
|
|
| 142 |
- Uploads user image to Digital Ocean Spaces (milestone/valentine/source/)
|
| 143 |
- Generates video using PixVerse API
|
| 144 |
- Stores result video in Digital Ocean Spaces (milestone/valentine/results/)
|
| 145 |
-
- Automatically matches prompt_text to
|
| 146 |
- Tracks media clicks in MongoDB based on appname
|
| 147 |
- Logs request to MongoDB Logs database
|
| 148 |
- Returns URLs for both source image and generated video
|
| 149 |
|
| 150 |
Category Matching (based on prompt_text keywords):
|
| 151 |
-
- "kiss" β
|
| 152 |
-
- "hug" β
|
|
|
|
|
|
|
| 153 |
|
| 154 |
Database Routing (based on appname):
|
| 155 |
- "collage-maker" β collage-maker MongoDB β adminPanel DB β media_clicks collection
|
|
|
|
| 131 |
async def generate_video(
|
| 132 |
image: UploadFile = File(..., description="User image file (JPG, PNG, WebP)"),
|
| 133 |
user_id: Optional[str] = Form(None, description="User ID (ObjectId string or integer)"),
|
| 134 |
+
prompt_text: str = Form(..., description="Prompt text for video generation (must contain keywords: kiss, hug, bf/boyfriend, gf/girlfriend)"),
|
| 135 |
firebase_id_token: str = Form(..., description="Firebase ID token"),
|
| 136 |
appname: Optional[str] = Form(None, description="App name for database routing (collage-maker, AI-Enhancer, etc.)"),
|
| 137 |
authorization: Optional[str] = Header(None, description="HF Token as Bearer token")
|
|
|
|
| 142 |
- Uploads user image to Digital Ocean Spaces (milestone/valentine/source/)
|
| 143 |
- Generates video using PixVerse API
|
| 144 |
- Stores result video in Digital Ocean Spaces (milestone/valentine/results/)
|
| 145 |
+
- Automatically matches prompt_text to one of 4 categories
|
| 146 |
- Tracks media clicks in MongoDB based on appname
|
| 147 |
- Logs request to MongoDB Logs database
|
| 148 |
- Returns URLs for both source image and generated video
|
| 149 |
|
| 150 |
Category Matching (based on prompt_text keywords):
|
| 151 |
+
- "kiss" β Ai Kiss Video
|
| 152 |
+
- "hug" β Ai Hug Video
|
| 153 |
+
- "bf" or "boyfriend" β Ai BF
|
| 154 |
+
- "gf" or "girlfriend" β Ai GF
|
| 155 |
|
| 156 |
Database Routing (based on appname):
|
| 157 |
- "collage-maker" β collage-maker MongoDB β adminPanel DB β media_clicks collection
|
services/mongodb_service.py
CHANGED
|
@@ -476,9 +476,14 @@ def get_category_name(category_id: str, appname: Optional[str] = None) -> Option
|
|
| 476 |
|
| 477 |
|
| 478 |
# Pixverse category mapping - keyword to category name
|
|
|
|
| 479 |
PIXVERSE_CATEGORIES = {
|
| 480 |
-
"kiss": "
|
| 481 |
-
"hug": "
|
|
|
|
|
|
|
|
|
|
|
|
|
| 482 |
}
|
| 483 |
|
| 484 |
|
|
|
|
| 476 |
|
| 477 |
|
| 478 |
# Pixverse category mapping - keyword to category name
|
| 479 |
+
# 4 types of videos: AI BF, AI GF, AI Hug Video, AI Kiss Video
|
| 480 |
PIXVERSE_CATEGORIES = {
|
| 481 |
+
"kiss": "Ai Kiss Video",
|
| 482 |
+
"hug": "Ai Hug Video",
|
| 483 |
+
"boyfriend": "Ai BF",
|
| 484 |
+
"bf": "Ai BF",
|
| 485 |
+
"girlfriend": "Ai GF",
|
| 486 |
+
"gf": "Ai GF"
|
| 487 |
}
|
| 488 |
|
| 489 |
|