mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-05 01:38:44 +00:00
premium plan features
This commit is contained in:
1 parent
ebed726768
commit
e676df0bf4
3 files changed
+39
-24
No files matched your search
@@ -47,6 +47,8 @@ pub struct Plan {
|
||||
|
||||
lipsync_requires_frontend_keepalive: bool,
|
||||
|
||||
can_remove_visual_watermarks: bool,
|
||||
|
||||
// ========== Features for TTS ==========
|
||||
|
||||
tts_base_priority_level: u8,
|
||||
@@ -89,6 +91,7 @@ impl Plan {
|
||||
is_development_plan: builder.is_development_plan,
|
||||
is_synthetic_plan: builder.is_synthetic_plan,
|
||||
lipsync_requires_frontend_keepalive: builder.lipsync_requires_frontend_keepalive,
|
||||
can_remove_visual_watermarks: builder.can_remove_visual_watermarks,
|
||||
tts_base_priority_level: builder.tts_base_priority_level,
|
||||
tts_max_duration: builder.tts_max_duration,
|
||||
tts_max_character_length: builder.tts_max_character_length,
|
||||
@@ -143,6 +146,10 @@ impl Plan {
|
||||
self.lipsync_requires_frontend_keepalive
|
||||
}
|
||||
|
||||
pub fn can_remove_visual_watermarks(&self) -> bool {
|
||||
self.can_remove_visual_watermarks
|
||||
}
|
||||
|
||||
pub fn tts_base_priority_level(&self) -> u8 {
|
||||
self.tts_base_priority_level
|
||||
}
|
||||
@@ -183,6 +190,8 @@ pub struct PlanBuilder {
|
||||
|
||||
lipsync_requires_frontend_keepalive: bool,
|
||||
|
||||
can_remove_visual_watermarks: bool,
|
||||
|
||||
// ========== Features for TTS ==========
|
||||
|
||||
tts_base_priority_level: u8,
|
||||
@@ -228,6 +237,7 @@ impl PlanBuilder {
|
||||
|
||||
// Lipsync (SadTalker, not Wav2Lip)
|
||||
lipsync_requires_frontend_keepalive: true,
|
||||
can_remove_visual_watermarks: false,
|
||||
|
||||
// TTS
|
||||
tts_base_priority_level : TTS_DEFAULT_PRIORITY_LEVEL,
|
||||
@@ -294,6 +304,11 @@ impl PlanBuilder {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn can_remove_visual_watermarks(mut self, value: bool) -> Self {
|
||||
self.can_remove_visual_watermarks = value;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn tts_base_priority_level(mut self, value: u8) -> Self {
|
||||
self.tts_base_priority_level = value;
|
||||
self
|
||||
|
||||
@@ -146,6 +146,7 @@ pub static PRODUCTION_PREMIUM_PLANS: Lazy<HashSet<Plan>> = Lazy::new(|| {
|
||||
.web_vc_base_priority_level(30)
|
||||
.web_vc_requires_frontend_keepalive(false)
|
||||
.lipsync_requires_frontend_keepalive(false)
|
||||
.can_remove_visual_watermarks(true)
|
||||
.build());
|
||||
|
||||
plans.insert(PlanBuilder::new("fakeyou_elite")
|
||||
@@ -159,6 +160,7 @@ pub static PRODUCTION_PREMIUM_PLANS: Lazy<HashSet<Plan>> = Lazy::new(|| {
|
||||
.web_vc_base_priority_level(40)
|
||||
.web_vc_requires_frontend_keepalive(false)
|
||||
.lipsync_requires_frontend_keepalive(false)
|
||||
.can_remove_visual_watermarks(true)
|
||||
.build());
|
||||
|
||||
// ========== Spanish plans ==========
|
||||
|
||||
+22
-24
@@ -45,20 +45,20 @@ pub struct EnqueueLipsyncAnimationRequest {
|
||||
|
||||
creator_set_visibility: Option<Visibility>,
|
||||
|
||||
///// SadTalker: cropping
|
||||
//crop: Option<CropMode>,
|
||||
/// Width/height of the video to generate (presets)
|
||||
dimensions: Option<FrameSize>,
|
||||
|
||||
/// SadTalker: parameter to make the animation more still.
|
||||
make_still: Option<bool>,
|
||||
|
||||
/// SadTalker: parameter to enhance the face using gfpgan.
|
||||
high_quality: Option<bool>,
|
||||
/// SadTalker: we use gfpgan face enhancement by default; this disables it.
|
||||
disable_face_enhancement: Option<bool>,
|
||||
|
||||
/// Remove the watermark
|
||||
/// Remove the watermark (premium only)
|
||||
remove_watermark: Option<bool>,
|
||||
|
||||
/// Size of the video to generate
|
||||
dimensions: Option<FrameSize>,
|
||||
///// SadTalker: cropping
|
||||
//crop: Option<CropMode>,
|
||||
}
|
||||
|
||||
//#[derive(Deserialize, Copy, Clone)]
|
||||
@@ -165,8 +165,6 @@ pub async fn enqueue_lipsync_animation_handler(
|
||||
server_state: web::Data<Arc<ServerState>>) -> Result<HttpResponse, EnqueueLipsyncAnimationError>
|
||||
{
|
||||
let mut maybe_user_token : Option<UserToken> = None;
|
||||
let priority_level ;
|
||||
let disable_rate_limiter = false; // NB: Careful!
|
||||
|
||||
let mut mysql_connection = server_state.mysql_pool
|
||||
.acquire()
|
||||
@@ -197,7 +195,7 @@ pub async fn enqueue_lipsync_animation_handler(
|
||||
maybe_user_session.as_ref());
|
||||
|
||||
// TODO: Separate priority for animation.
|
||||
priority_level = plan.web_vc_base_priority_level();
|
||||
let priority_level = plan.web_vc_base_priority_level();
|
||||
|
||||
// ==================== DEBUG MODE + ROUTING TAG ==================== //
|
||||
|
||||
@@ -211,20 +209,18 @@ pub async fn enqueue_lipsync_animation_handler(
|
||||
|
||||
// ==================== RATE LIMIT ==================== //
|
||||
|
||||
if !disable_rate_limiter {
|
||||
let rate_limiter = match maybe_user_session {
|
||||
None => &server_state.redis_rate_limiters.logged_out,
|
||||
Some(ref user) => {
|
||||
if user.role.is_banned {
|
||||
return Err(EnqueueLipsyncAnimationError::NotAuthorized);
|
||||
}
|
||||
&server_state.redis_rate_limiters.logged_in
|
||||
},
|
||||
};
|
||||
let rate_limiter = match maybe_user_session {
|
||||
None => &server_state.redis_rate_limiters.logged_out,
|
||||
Some(ref user) => {
|
||||
if user.role.is_banned {
|
||||
return Err(EnqueueLipsyncAnimationError::NotAuthorized);
|
||||
}
|
||||
&server_state.redis_rate_limiters.logged_in
|
||||
},
|
||||
};
|
||||
|
||||
if let Err(_err) = rate_limiter.rate_limit_request(&http_request) {
|
||||
return Err(EnqueueLipsyncAnimationError::RateLimited);
|
||||
}
|
||||
if let Err(_err) = rate_limiter.rate_limit_request(&http_request) {
|
||||
return Err(EnqueueLipsyncAnimationError::RateLimited);
|
||||
}
|
||||
|
||||
// ==================== LOOK UP MODEL INFO ==================== //
|
||||
@@ -277,7 +273,9 @@ pub async fn enqueue_lipsync_animation_handler(
|
||||
maybe_resize_height: None,
|
||||
};
|
||||
|
||||
if request.high_quality.unwrap_or(false) {
|
||||
let enable_face_enhancement = !request.disable_face_enhancement.unwrap_or(false);
|
||||
|
||||
if enable_face_enhancement {
|
||||
inference_args.maybe_face_enhancer = Some(FaceEnhancer::G); // "--enhancer gfpgan"
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user