lucianosb commited on
Commit
9f0eeff
1 Parent(s): 8347836

adds docstrings

Browse files
Files changed (1) hide show
  1. app.py +33 -1
app.py CHANGED
@@ -7,7 +7,6 @@ import spaces
7
  default_model = "lucianosb/acaraje-brazil-xl"
8
  default_prompt = "delicious acarajé"
9
 
10
- @spaces.GPU
11
  pipeline = StableDiffusionXLPipeline.from_single_file(
12
  "https://huggingface.co/lucianosb/sinteticoXL-models/blob/main/sinteticoXL_v1dot2.safetensors",
13
  torch_dtype=torch.float16,
@@ -16,6 +15,16 @@ pipeline = StableDiffusionXLPipeline.from_single_file(
16
  ).to("cuda")
17
 
18
  def make_description(model):
 
 
 
 
 
 
 
 
 
 
19
  pipeline.unload_lora_weights()
20
  model_keywords = {
21
  "lucianosb/acaraje-brazil-xl": ["acarajé", "acaraje"],
@@ -36,6 +45,16 @@ def make_description(model):
36
  return "Triggered with the following keywords: \n\n" + "- " + "\n- ".join(keywords)
37
 
38
  def make_prompt(model):
 
 
 
 
 
 
 
 
 
 
39
  prompts = {
40
  "lucianosb/acaraje-brazil-xl": "delicious acarajé",
41
  "lucianosb/boto-brazil-xl": "beautiful boto in a river",
@@ -55,6 +74,19 @@ def make_prompt(model):
55
 
56
  @spaces.GPU
57
  def make_image(model, prompt):
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  weight_file_names = {
59
  "lucianosb/acaraje-brazil-xl": "Acarajé_-_Brazil_XL.safetensors",
60
  "lucianosb/boto-brazil-xl": "Boto_-_Brazil_XL.safetensors",
 
7
  default_model = "lucianosb/acaraje-brazil-xl"
8
  default_prompt = "delicious acarajé"
9
 
 
10
  pipeline = StableDiffusionXLPipeline.from_single_file(
11
  "https://huggingface.co/lucianosb/sinteticoXL-models/blob/main/sinteticoXL_v1dot2.safetensors",
12
  torch_dtype=torch.float16,
 
15
  ).to("cuda")
16
 
17
  def make_description(model):
18
+ """
19
+ Generates a description based on the given model.
20
+
21
+ Parameters:
22
+ model (str): The name of the model.
23
+
24
+ Returns:
25
+ str: The generated description.
26
+
27
+ """
28
  pipeline.unload_lora_weights()
29
  model_keywords = {
30
  "lucianosb/acaraje-brazil-xl": ["acarajé", "acaraje"],
 
45
  return "Triggered with the following keywords: \n\n" + "- " + "\n- ".join(keywords)
46
 
47
  def make_prompt(model):
48
+ """
49
+ Generates a prompt based on the given model.
50
+
51
+ Parameters:
52
+ model (str): The name of the model.
53
+
54
+ Returns:
55
+ str: The generated prompt.
56
+
57
+ """
58
  prompts = {
59
  "lucianosb/acaraje-brazil-xl": "delicious acarajé",
60
  "lucianosb/boto-brazil-xl": "beautiful boto in a river",
 
74
 
75
  @spaces.GPU
76
  def make_image(model, prompt):
77
+ """
78
+ Generates an image based on the given model and prompt.
79
+
80
+ Args:
81
+ model (str): The name of the model.
82
+ prompt (str): The prompt to generate the image.
83
+
84
+ Returns:
85
+ PIL.Image.Image: The generated image.
86
+
87
+ Raises:
88
+ ValueError: If the model is invalid.
89
+ """
90
  weight_file_names = {
91
  "lucianosb/acaraje-brazil-xl": "Acarajé_-_Brazil_XL.safetensors",
92
  "lucianosb/boto-brazil-xl": "Boto_-_Brazil_XL.safetensors",