dayona commited on
Commit
671bc57
·
1 Parent(s): 26bbca0

add multi-key payload compatibility for mode prompt_mode and nsfw to guarantee NSFW accuracy

Browse files
Files changed (1) hide show
  1. prompt_enhancer.py +13 -6
prompt_enhancer.py CHANGED
@@ -197,21 +197,28 @@ def call_sulphur_enhancer_api(
197
  kamera_param = "orbit"
198
 
199
  m_str = str(mode or "nsfw").lower()
200
- mode_param = "nsfw"
201
- if "sfw" in m_str:
202
- mode_param = "sfw"
203
- elif "general" in m_str:
204
  mode_param = "general"
 
 
 
 
205
 
206
  endpoint = f"{clean_url}/api/v1/enhance-prompt"
207
 
208
- # Strictly matched payload specification from api.doc.md
209
  data = {
210
  "subject": str(subject or "beautiful woman"),
211
  "adegan": str(adegan or "cinematic motion"),
212
  "kamera": kamera_param,
 
213
  "durasi": str(int(duration)) if duration else "4",
214
- "mode": mode_param,
 
 
 
215
  "enhance": "true" if enable_swap else "false"
216
  }
217
 
 
197
  kamera_param = "orbit"
198
 
199
  m_str = str(mode or "nsfw").lower()
200
+ if "nsfw" in m_str:
201
+ mode_param = "nsfw"
202
+ elif "general" in m_str or "action" in m_str:
 
203
  mode_param = "general"
204
+ elif "sfw" in m_str:
205
+ mode_param = "sfw"
206
+ else:
207
+ mode_param = "nsfw"
208
 
209
  endpoint = f"{clean_url}/api/v1/enhance-prompt"
210
 
211
+ # Fully multi-key compatible payload matching api.doc.md
212
  data = {
213
  "subject": str(subject or "beautiful woman"),
214
  "adegan": str(adegan or "cinematic motion"),
215
  "kamera": kamera_param,
216
+ "camera_setting": str(camera_setting or "statis"),
217
  "durasi": str(int(duration)) if duration else "4",
218
+ "duration": str(int(duration)) if duration else "4",
219
+ "mode": str(mode or mode_param),
220
+ "prompt_mode": mode_param,
221
+ "nsfw": "true" if mode_param == "nsfw" else "false",
222
  "enhance": "true" if enable_swap else "false"
223
  }
224