Profakerr commited on
Commit
a2e4ef2
·
verified ·
1 Parent(s): 03839a8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -1
app.py CHANGED
@@ -25,6 +25,9 @@ def download_lora(url):
25
 
26
  # If file already exists in cache, return the path
27
  if os.path.exists(local_path):
 
 
 
28
  return local_path
29
 
30
  # Download the file
@@ -43,10 +46,14 @@ def download_lora(url):
43
  for chunk in response.iter_content(chunk_size=8192):
44
  if chunk:
45
  f.write(chunk)
46
-
 
 
47
  return local_path
48
  except Exception as e:
 
49
  print(f"Error downloading LoRA: {str(e)}")
 
50
  return None
51
 
52
  def is_civitai_url(url):
@@ -100,17 +107,33 @@ def generate_image(prompt, negative_prompt, lora_url, num_inference_steps=30, gu
100
  lora_path = download_lora(lora_url)
101
  if lora_path:
102
  pipe.load_lora_weights(lora_path)
 
 
 
 
103
  else:
104
  pipe.load_lora_weights(DEFAULT_LORA)
 
 
 
 
105
  # If it's a HuggingFace repo path
106
  elif '/' in lora_url and not lora_url.startswith('http'):
107
  pipe.load_lora_weights(lora_url)
 
 
 
108
  else:
109
  pipe.load_lora_weights(DEFAULT_LORA)
 
 
 
110
  else:
111
  pipe.load_lora_weights(DEFAULT_LORA)
112
  except Exception as e:
 
113
  print(f"Error loading LoRA weights: {str(e)}")
 
114
  pipe.load_lora_weights(DEFAULT_LORA)
115
 
116
  if model == "Real6.0":
 
25
 
26
  # If file already exists in cache, return the path
27
  if os.path.exists(local_path):
28
+ print()
29
+ print("********** Lora Already Exists **********")
30
+ print()
31
  return local_path
32
 
33
  # Download the file
 
46
  for chunk in response.iter_content(chunk_size=8192):
47
  if chunk:
48
  f.write(chunk)
49
+ print()
50
+ print("********** Lora Downloading Successfull **********")
51
+ print()
52
  return local_path
53
  except Exception as e:
54
+ print()
55
  print(f"Error downloading LoRA: {str(e)}")
56
+ print()
57
  return None
58
 
59
  def is_civitai_url(url):
 
107
  lora_path = download_lora(lora_url)
108
  if lora_path:
109
  pipe.load_lora_weights(lora_path)
110
+ print()
111
+ print("********** URL Lora Loaded **********")
112
+ print()
113
+
114
  else:
115
  pipe.load_lora_weights(DEFAULT_LORA)
116
+ print()
117
+ print("********** Default Lora Loaded **********")
118
+ print()
119
+
120
  # If it's a HuggingFace repo path
121
  elif '/' in lora_url and not lora_url.startswith('http'):
122
  pipe.load_lora_weights(lora_url)
123
+ print()
124
+ print("********** URL Lora Loaded **********")
125
+ print()
126
  else:
127
  pipe.load_lora_weights(DEFAULT_LORA)
128
+ print()
129
+ print("********** Default Lora Loaded **********")
130
+ print()
131
  else:
132
  pipe.load_lora_weights(DEFAULT_LORA)
133
  except Exception as e:
134
+ print()
135
  print(f"Error loading LoRA weights: {str(e)}")
136
+ print()
137
  pipe.load_lora_weights(DEFAULT_LORA)
138
 
139
  if model == "Real6.0":