besarismaili commited on
Commit
067894a
1 Parent(s): bb5f0a2
Files changed (2) hide show
  1. .gitignore +2 -1
  2. app.py +76 -17
.gitignore CHANGED
@@ -111,4 +111,5 @@ venv.bak/
111
 
112
  # Files
113
  api.py
114
- /frames
 
 
111
 
112
  # Files
113
  api.py
114
+ /frames
115
+ /nukeHF
app.py CHANGED
@@ -1,18 +1,11 @@
1
  import os
2
- import io
3
- import base64
4
  import gradio as gr
5
  from stability_sdk.api import Context
6
  from stability_sdk.animation import AnimationArgs, Animator
7
- from dotenv import load_dotenv
8
-
9
- load_dotenv(".env")
10
 
11
  STABILITY_HOST = "grpc.stability.ai:443"
12
- #STABILITY_KEY = os.getenv("STABILITY_KEY")
13
-
14
 
15
- def anim(f_promt, s_promt, stability_key):
16
  # Connect to Stability API
17
  context = Context(STABILITY_HOST, stability_key)
18
  # Test the connection
@@ -21,13 +14,81 @@ def anim(f_promt, s_promt, stability_key):
21
 
22
  # Configure the animation
23
  args = AnimationArgs()
24
- args.interpolate_prompts = True
25
- args.locked_seed = True
26
- args.max_frames = 5
27
- args.seed = 42
28
- args.strength_curve = "0:(0)"
29
- args.diffusion_cadence_curve = "0:(4)"
30
- args.cadence_interp = "film"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
 
32
  animation_prompts = {
33
  0: f_promt,
@@ -42,8 +103,6 @@ def anim(f_promt, s_promt, stability_key):
42
  negative_prompt=negative_prompt,
43
  args=args
44
  )
45
- # Get root folder of the repository
46
- repo_dir = os.getenv('HF_COMET_ROOT_PATH', '/')
47
 
48
  # Define output folder path
49
  image_path = "/tmp/frames/"
 
1
  import os
 
 
2
  import gradio as gr
3
  from stability_sdk.api import Context
4
  from stability_sdk.animation import AnimationArgs, Animator
 
 
 
5
 
6
  STABILITY_HOST = "grpc.stability.ai:443"
 
 
7
 
8
+ def anim(f_promt, s_promt, stability_key, cadence_interp, width ,height ,sampler ,model ,custom_model ,seed ,cfg_scale ,clip_guidance ,init_image ,init_sizing ,mask_path ,mask_invert ,preset ,animation_mode ,max_frames ,border ,noise_add_curve ,noise_scale_curve ,strength_curve ,steps_curve ,steps_strength_adj ,interpolate_prompts ,locked_seed ,angle ,zoom ,translation_x ,translation_y ,translation_z ,rotation_x ,rotation_y ,rotation_z ,diffusion_cadence_curve ,cadence_spans ,color_coherence ,brightness_curve ,contrast_curve ,hue_curve ,saturation_curve ,lightness_curve ,color_match_animate ,depth_model_weight,near_plane ,far_plane ,fov_curve ,depth_blur_curve ,depth_warp_curve ,save_depth_maps ,camera_type ,render_mode ,mask_power ,use_inpainting_model ,inpaint_border ,mask_min_value ,mask_binarization_thr ,save_inpaint_masks ,video_init_path ,extract_nth_frame ,video_mix_in_curve ,video_flow_warp ,fps ,reverse ):
9
  # Connect to Stability API
10
  context = Context(STABILITY_HOST, stability_key)
11
  # Test the connection
 
14
 
15
  # Configure the animation
16
  args = AnimationArgs()
17
+ args.interpolate_prompts = interpolate_prompts
18
+ args.locked_seed = locked_seed
19
+ args.max_frames = max_frames
20
+ args.seed = seed
21
+ args.strength_curve = strength_curve
22
+ args.diffusion_cadence_curve = diffusion_cadence_curve
23
+ args.cadence_interp = cadence_interp
24
+ args.width = width
25
+ args.height = height
26
+ args.sampler = sampler
27
+ args.model = model
28
+ args.custom_model = custom_model
29
+ args.seed = seed
30
+ args.cfg_scale = cfg_scale
31
+ args.clip_guidance = clip_guidance
32
+ args.init_image = init_image
33
+ args.init_sizing = init_sizing
34
+ args.mask_path = mask_path
35
+ args.mask_invert = mask_invert
36
+ args.preset = preset
37
+ args.animation_mode = animation_mode
38
+ args.max_frames = max_frames
39
+ args.border = border
40
+ args.noise_add_curve = noise_add_curve
41
+ args.noise_scale_curve = noise_scale_curve
42
+ args.strength_curve = strength_curve
43
+ args.steps_curve = steps_curve
44
+ args.steps_strength_adj = steps_strength_adj
45
+ args.interpolate_prompts = interpolate_prompts
46
+ args.locked_seed = locked_seed
47
+ args.angle = angle
48
+ args.zoom = zoom
49
+ args.translation_x = translation_x
50
+ args.translation_y = translation_y
51
+ args.translation_z = translation_z
52
+ args.rotation_x = rotation_x
53
+ args.rotation_y = rotation_y
54
+ args.rotation_z = rotation_z
55
+
56
+ args.diffusion_cadence_curve = diffusion_cadence_curve
57
+ args.cadence_spans = cadence_spans
58
+
59
+ args.color_coherence = color_coherence
60
+ args.brightness_curve = brightness_curve
61
+ args.contrast_curve = contrast_curve
62
+ args.hue_curve = hue_curve
63
+ args.saturation_curve = saturation_curve
64
+ args.lightness_curve = lightness_curve
65
+ args.color_match_animate = color_match_animate
66
+
67
+ args.depth_model_weight = depth_model_weight
68
+ args.near_plane = near_plane
69
+ args.far_plane = far_plane
70
+ args.fov_curve = fov_curve
71
+ args.depth_blur_curve = depth_blur_curve
72
+ args.depth_warp_curve = depth_warp_curve
73
+ args.save_depth_maps = save_depth_maps
74
+
75
+ args.camera_type = camera_type
76
+ args.render_mode = render_mode
77
+ args.mask_power = mask_power
78
+
79
+ args.use_inpainting_model = use_inpainting_model
80
+ args.inpaint_border = inpaint_border
81
+ args.mask_min_value = mask_min_value
82
+ args.mask_binarization_thr = mask_binarization_thr
83
+ args.save_inpaint_masks = save_inpaint_masks
84
+
85
+ args.video_init_path = video_init_path
86
+ args.extract_nth_frame = extract_nth_frame
87
+ args.video_mix_in_curve = video_mix_in_curve
88
+ args.video_flow_warp = video_flow_warp
89
+
90
+ args.fps = fps
91
+ args.reverse = reverse
92
 
93
  animation_prompts = {
94
  0: f_promt,
 
103
  negative_prompt=negative_prompt,
104
  args=args
105
  )
 
 
106
 
107
  # Define output folder path
108
  image_path = "/tmp/frames/"