2525# NOTE: since running locally is very slow (comfy startup, models loading, other gens in process..)
2626# rn we are accessing the replicate API directly, will switch to some other local method in the future
2727
28+
2829def check_replicate_key ():
2930 data_repo = DataRepo ()
3031 app_secrets = data_repo .get_app_secrets_from_user_uuid ()
@@ -41,7 +42,7 @@ def check_replicate_key():
4142
4243def edit_prompts (edit_text , list_of_prompts ):
4344 # Convert list of prompts to a single string separated by '|'
44- prompts_string = '|' .join (list_of_prompts )
45+ prompts_string = "|" .join (list_of_prompts )
4546
4647 query_data = {
4748 "top_p" : 0.9 ,
@@ -54,23 +55,23 @@ def edit_prompts(edit_text, list_of_prompts):
5455 "presence_penalty" : 1.15 ,
5556 "stop_sequences" : " " ,
5657 }
57-
58+
5859 output = replicate .run (
5960 "meta/meta-llama-3-8b" ,
6061 input = query_data ,
6162 )
6263
6364 proper_output = "" # Initialize an empty string to accumulate outputs
6465 for item in output :
65- if isinstance (item , dict ) and ' output' in item :
66- proper_output += item [' output' ] # Concatenate each output to the proper_output string
66+ if isinstance (item , dict ) and " output" in item :
67+ proper_output += item [" output" ] # Concatenate each output to the proper_output string
6768 else :
6869 proper_output += str (item ) # Handle cases where item is not a dictionary
69-
70+
7071 list_of_prompts = proper_output .strip ()
71- list_of_prompts = list_of_prompts .lstrip (' \n ' )
72+ list_of_prompts = list_of_prompts .lstrip (" \n " )
7273 # Proper output should be only before the first \n
73- list_of_prompts = list_of_prompts .split ("\n " )[0 ]
74+ list_of_prompts = list_of_prompts .split ("\n " )[0 ]
7475
7576 return list_of_prompts
7677
@@ -100,14 +101,14 @@ def generate_prompts(
100101
101102 proper_output = "" # Initialize an empty string to accumulate outputs
102103 for item in output :
103- if isinstance (item , dict ) and ' output' in item :
104- proper_output += item [' output' ] # Concatenate each output to the proper_output string
104+ if isinstance (item , dict ) and " output" in item :
105+ proper_output += item [" output" ] # Concatenate each output to the proper_output string
105106 else :
106107 proper_output += str (item ) # Handle cases where item is not a dictionary
107108 list_of_prompts = proper_output .strip ()
108- list_of_prompts = list_of_prompts .lstrip (' \n ' )
109+ list_of_prompts = list_of_prompts .lstrip (" \n " )
109110 # Proper output should be only before the first \n
110- list_of_prompts = proper_output .split ("\n " )[0 ]
111+ list_of_prompts = proper_output .split ("\n " )[0 ]
111112 return list_of_prompts
112113
113114
@@ -132,8 +133,8 @@ def inspiration_engine_element(project_uuid, position="explorer", shot_uuid=None
132133 style_reference_list = [
133134 {
134135 "name" : "The Strangest Dream" ,
135- "images" : [
136- "https://banodoco.s3.amazonaws.com/plan /strangest_dream_2.png" ,
136+ "images" : [
137+ "https://banodoco-data-bucket-public .s3.ap-south-1. amazonaws.com/general_pics /strangest_dream_2.png" ,
137138 ],
138139 "description" : "Bold, dark colors, Dark Blue & red dominant, dream like, surreal." ,
139140 "models_works_best_with" : "Dreamshaper, Deliberate" ,
@@ -144,7 +145,7 @@ def inspiration_engine_element(project_uuid, position="explorer", shot_uuid=None
144145 {
145146 "name" : "Green Hard Funk" ,
146147 "images" : [
147- "https://banodoco.s3.amazonaws.com/plan /green_hard_funk_1.png" ,
148+ "https://banodoco-data-bucket-public .s3.ap-south-1. amazonaws.com/general_pics /green_hard_funk_1.png" ,
148149 ],
149150 "description" : "Dominant green tones, red accents, high contrast, geometrical lining." ,
150151 "models_works_best_with" : "Dreamshaper, Deliberate" ,
@@ -155,7 +156,7 @@ def inspiration_engine_element(project_uuid, position="explorer", shot_uuid=None
155156 {
156157 "name" : "Nordic Pale Blue" ,
157158 "images" : [
158- "https://banodoco.s3.amazonaws.com/plan /nordic_pale_blue_1.png" ,
159+ "https://banodoco-data-bucket-public .s3.ap-south-1. amazonaws.com/general_pics /nordic_pale_blue_1.png" ,
159160 ],
160161 "description" : "Pale blue, grey, pastel colors, ornamental and decorative details." ,
161162 "models_works_best_with" : "Dreamshaper, Deliberate" ,
@@ -166,7 +167,7 @@ def inspiration_engine_element(project_uuid, position="explorer", shot_uuid=None
166167 {
167168 "name" : "Insane Animane" ,
168169 "images" : [
169- "https://banodoco.s3.amazonaws.com/plan /insane_animane_1.png" ,
170+ "https://banodoco-data-bucket-public .s3.ap-south-1. amazonaws.com/general_pics /insane_animane_1.png" ,
170171 ],
171172 "description" : "Detailed animation style, Blue, orange, white dominant, intense, expressive" ,
172173 "models_works_best_with" : "Dreamshaper, Deliberate" ,
@@ -176,8 +177,8 @@ def inspiration_engine_element(project_uuid, position="explorer", shot_uuid=None
176177 },
177178 {
178179 "name" : "Delicate Pink Glimmer" ,
179- "images" : [
180- "https://banodoco.s3.amazonaws.com/plan /delicate_pink_2.png" ,
180+ "images" : [
181+ "https://banodoco-data-bucket-public .s3.ap-south-1. amazonaws.com/general_pics /delicate_pink_2.png" ,
181182 ],
182183 "description" : "Delicate lines, soft colors, pink-blue & green dominant, misty/glimmer shine." ,
183184 "models_works_best_with" : "Deliberate, Realistic Vision" ,
@@ -560,21 +561,20 @@ def inspiration_engine_element(project_uuid, position="explorer", shot_uuid=None
560561 preview1 , preview2 , preview_3 = st .columns ([1 , 1 , 1 ])
561562 with preview1 :
562563 preset_images = items [[item ["name" ] for item in items ].index (preset_style )]["images" ]
563-
564+
564565 st .image (preset_images [0 ])
565-
566+
566567 with preview2 :
567568 st .info (
568- f"""**Recommended animation styling models:** { items [[item ["name" ] for item in items ].index (preset_style )]["models_works_best_with" ]}
569+ f"""**Recommended animation styling models:** { items [[item ["name" ] for item in items ].index (preset_style )]["models_works_best_with" ]}
569570 \n **Recommended workflow:** { items [[item ["name" ] for item in items ].index (preset_style )]["workflows_works_best_with" ]}
570571 \n **Created by:** { items [[item ["name" ] for item in items ].index (preset_style )]["created_by" ]}
571572 \n **Description:** { items [[item ["name" ] for item in items ].index (preset_style )]["description" ]}
572573"""
573- )
574+ )
574575
575- with preview_3 :
576+ with preview_3 :
576577 st .video (items [[item ["name" ] for item in items ].index (preset_style )]["example_video" ])
577-
578578
579579 else :
580580 st .session_state ["list_of_style_references" ] = []
@@ -656,7 +656,7 @@ def inspiration_engine_element(project_uuid, position="explorer", shot_uuid=None
656656 help = ""
657657
658658 st .markdown ("***" )
659- if st .button ("Generate images" , type = "primary" ,disabled = button_status , help = help ):
659+ if st .button ("Generate images" , type = "primary" , disabled = button_status , help = help ):
660660
661661 if type_of_style_input == "Choose From List" :
662662 st .session_state ["list_of_style_references" ] = preset_images
0 commit comments