Spaces:
Sleeping
Sleeping
Andre
commited on
Commit
·
ef35d03
1
Parent(s):
3a78636
“Update”
Browse files- src/img_gen_colab.py +1 -18
src/img_gen_colab.py
CHANGED
@@ -36,7 +36,7 @@ def generate_image(prompt, team_color, model_name, height, width, num_inference_
|
|
36 |
print("Original Prompt:")
|
37 |
print(prompt)
|
38 |
print(f"Enemy Color: {enemy_color}")
|
39 |
-
print(f"
|
40 |
|
41 |
prompt = prompt.format(team_color=team_color, enemy_color=enemy_color)
|
42 |
|
@@ -74,20 +74,3 @@ def generate_image(prompt, team_color, model_name, height, width, num_inference_
|
|
74 |
except Exception as e:
|
75 |
return f"An error occurred: {e}"
|
76 |
|
77 |
-
def save_image(image, model_label, seed, prompt_label, team):
|
78 |
-
"""
|
79 |
-
Save the generated image with a timestamped filename.
|
80 |
-
|
81 |
-
Args:
|
82 |
-
image (PIL.Image.Image): The generated image.
|
83 |
-
model_label (str): The label of the selected model.
|
84 |
-
prompt_label (str): The label of the selected prompt.
|
85 |
-
team (str): The selected team ("Red" or "Blue").
|
86 |
-
|
87 |
-
Returns:
|
88 |
-
str: The filename of the saved image.
|
89 |
-
"""
|
90 |
-
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
91 |
-
output_filename = f"{timestamp}_{model_label.replace(' ', '_').lower()}_{seed}_{prompt_label.replace(' ', '_').lower()}_{team.lower()}.png"
|
92 |
-
image.save(output_filename)
|
93 |
-
return output_filename
|
|
|
36 |
print("Original Prompt:")
|
37 |
print(prompt)
|
38 |
print(f"Enemy Color: {enemy_color}")
|
39 |
+
print(f"Team Color: {team_color}")
|
40 |
|
41 |
prompt = prompt.format(team_color=team_color, enemy_color=enemy_color)
|
42 |
|
|
|
74 |
except Exception as e:
|
75 |
return f"An error occurred: {e}"
|
76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|