tonyassi commited on
Commit
37cbb3a
·
verified ·
1 Parent(s): f87566d

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +140 -0
README.md ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ pipeline_tag: video-to-video
3
+ ---
4
+ # Face Swap Video
5
+ ### Simple HTTP endpoint to generate a face-swapped video.
6
+
7
+ [Website](https://www.face-swap.co?utm_source=faceswapmodel&utm_medium=website) | [Docs](https://www.face-swap.co/api?utm_source=faceswapmodel&utm_medium=docs) | [API Key](https://www.face-swap.co/api?utm_source=faceswapmodel&utm_medium=apikey)
8
+
9
+ The Face Swap API lets you generate AI face swap videos with a single HTTP request. Send a source face image, a target video URL, and the desired duration, and our service returns a deepfake-style video face swap URL.
10
+
11
+ [No code face swap video generations](https://www.face-swap.co?utm_source=faceswapmodel&utm_medium=nocodefaceswap)
12
+
13
+ [![Hugging Face Spaces](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue)](https://huggingface.co/spaces/tonyassi/video-face-swap)
14
+
15
+
16
+ <div class="banner-pos" style="width:400px;height:400px;position:relative;overflow:hidden;">
17
+ <video
18
+ class="banner-video"
19
+ id="banner-video"
20
+ preload="metadata"
21
+ poster="https://huggingface.co/spaces/ai-media/storage/resolve/main/banner-poster1.png"
22
+ autoplay muted loop playsinline
23
+ style="width:100%;height:100%;object-fit:cover;display:block;"
24
+ >
25
+ <source src="https://huggingface.co/spaces/tonyassi/storage/resolve/main/banner1.mp4" type="video/mp4">
26
+ Your browser does not support the video tag.
27
+ </video>
28
+
29
+ <button id="mute-btn" class="mute-btn" type="button" aria-label="Unmute"
30
+ style="position:absolute;right:12px;bottom:12px;z-index:2;">
31
+ 🔇
32
+ </button>
33
+ </div>
34
+
35
+ ```python
36
+ import requests
37
+
38
+ url = "https://www.face-swap.co/api/generate"
39
+ payload = {
40
+ "key": "YOUR_API_KEY",
41
+ "input_image_url": "https://tinyurl.com/elonmusk-faceswap",
42
+ "input_video_url": "https://tinyurl.com/ironman-faceswap",
43
+ "duration": 120, # required: 4 | 60 | 120 | 180 (use 4 for trial credits)
44
+ "gender": "all", # optional: all | female | male (default: all)
45
+ }
46
+
47
+ r = requests.post(url, json=payload, timeout=60)
48
+ r.raise_for_status()
49
+ print(r.json())
50
+ ```
51
+
52
+ [Get an API Key here](https://www.face-swap.co/api?utm_source=faceswapmodel&utm_medium=apikey)
53
+
54
+ <a href="https://colab.research.google.com/drive/1OfLNmgUiAek2wQbX5IOOJ5F4iwOUL8Wd?usp=sharing"
55
+ target="_blank" rel="noopener noreferrer"
56
+ style="display:inline-flex;align-items:center;gap:10px;padding:10px 14px;border:1px solid rgba(0,0,0,0.15);border-radius:10px;text-decoration:none;font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;font-size:14px;color:#111;background:#fff;">
57
+ <img src="https://colab.research.google.com/img/colab_favicon_256px.png"
58
+ alt="Google Colab"
59
+ style="height:22px;width:auto;display:block;">
60
+ <span style="font-weight:600;">Colab Notebook</span>
61
+ </a>
62
+
63
+ <a href="https://huggingface.co/spaces/tonyassi/face-swap-video-api"
64
+ target="_blank" rel="noopener noreferrer"
65
+ style="display:inline-flex;align-items:center;gap:10px;padding:10px 14px;border:1px solid rgba(0,0,0,0.15);border-radius:10px;text-decoration:none;font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;font-size:14px;color:#111;background:#fff;">
66
+ <img src="https://huggingface.co/front/assets/huggingface_logo-noborder.svg"
67
+ alt="Hugging Face"
68
+ style="height:22px;width:auto;display:block;">
69
+ <span style="font-weight:600;">API Playground</span>
70
+ </a>
71
+
72
+ ---
73
+
74
+ ## POST /api/generate
75
+ Create a face-swapped video job.
76
+
77
+ | Parameter | Type | Required | Description |
78
+ |---|---|---:|---|
79
+ | `key` | string | ✅ | Your API key |
80
+ | `input_image_url` | string | ✅ | Public URL to a face image |
81
+ | `input_video_url` | string | ✅ | Public URL to a target video |
82
+ | `duration` | int | ✅ | Allowed: `4`, `60`, `120`, `180` seconds (use `4` for trial credits) |
83
+ | `gender` | string | ❌ | `all` \| `female` \| `male` (default: `all`) |
84
+
85
+
86
+ ```python
87
+ import requests
88
+
89
+ url = "https://www.face-swap.co/api/generate"
90
+ payload = {
91
+ "key": "YOUR_API_KEY",
92
+ "input_image_url": "https://tinyurl.com/elonmusk-faceswap",
93
+ "input_video_url": "https://tinyurl.com/ironman-faceswap",
94
+ "duration": 120, # required: 4|60|120|180 (use 4 for trial credits)
95
+ "gender": "all", # optional: all|female|male (default: all)
96
+ }
97
+
98
+ r = requests.post(url, json=payload, timeout=60)
99
+ r.raise_for_status()
100
+ print(r.json())
101
+ ```
102
+
103
+ ## GET /api/status/{job_id}
104
+ Check the status of a job.
105
+
106
+ ```python
107
+ import requests
108
+
109
+ job_id = "0c1449fc0e764b5ebdfe24a52bd8f8fa"
110
+ r = requests.get(f"https://www.face-swap.co/api/status/{job_id}", timeout=30)
111
+ r.raise_for_status()
112
+ print(r.json())
113
+ ```
114
+
115
+ ## GET /api/credits/{API_KEY}
116
+ View remaining credits for your API key.
117
+
118
+ ```python
119
+ import requests
120
+
121
+ api_key = "YOUR_API_KEY"
122
+ r = requests.get(f"https://www.face-swap.co/api/credits/{api_key}", timeout=30)
123
+ r.raise_for_status()
124
+ print(r.json())
125
+ ```
126
+
127
+ ## GET /api/jobs/{API_KEY}
128
+ List recent jobs for your API key.
129
+
130
+ ```python
131
+ import requests
132
+
133
+ api_key = "YOUR_API_KEY"
134
+ r = requests.get(f"https://www.face-swap.co/api/jobs/{api_key}", timeout=30)
135
+ r.raise_for_status()
136
+ print(r.json())
137
+
138
+ ```
139
+
140
+ [Get an API Key here](https://www.face-swap.co/api?utm_source=faceswapmodel&utm_medium=apikey)