Update app.py
Browse files
app.py
CHANGED
@@ -106,8 +106,8 @@ def update_selection(evt: gr.SelectData, selected_indices, loras_state, width, h
|
|
106 |
selected_info_2 = "Select a LoRA 2"
|
107 |
lora_scale_1 = 1.15
|
108 |
lora_scale_2 = 1.15
|
109 |
-
lora_image_1 = "/path/to/default/image.png" #
|
110 |
-
lora_image_2 = "/path/to/default/image.png" #
|
111 |
if len(selected_indices) >= 1:
|
112 |
lora1 = loras_state[selected_indices[0]]
|
113 |
selected_info_1 = f"### LoRA 1 Selected: [{lora1['title']}](https://huggingface.co/{lora1['repo']}) β¨"
|
@@ -188,7 +188,7 @@ def add_custom_lora(custom_lora, selected_indices, current_loras, gallery):
|
|
188 |
if repo.endswith(".safetensors") and repo.startswith("http"):
|
189 |
repo = download_file(repo)
|
190 |
new_item = {
|
191 |
-
"image": image if image else "/
|
192 |
"title": title,
|
193 |
"repo": repo,
|
194 |
"weights": path,
|
@@ -285,7 +285,8 @@ def generate_image(prompt_mash, steps, seed, cfg_scale, width, height, progress)
|
|
285 |
with calculateDuration("Generating image"):
|
286 |
# Generate image
|
287 |
for img in pipe(prompt=prompt_mash, num_inference_steps=steps, guidance_scale=cfg_scale, width=width, height=height, generator=generator):
|
288 |
-
|
|
|
289 |
|
290 |
@spaces.GPU(duration=75)
|
291 |
def run_lora(prompt, selected_indices, loras_state):
|
@@ -394,7 +395,7 @@ def update_history(new_image, history):
|
|
394 |
history = []
|
395 |
history.insert(0, new_image)
|
396 |
return history
|
397 |
-
|
398 |
css = '''
|
399 |
#gen_btn{height: 100%}
|
400 |
#title{text-align: center}
|
|
|
106 |
selected_info_2 = "Select a LoRA 2"
|
107 |
lora_scale_1 = 1.15
|
108 |
lora_scale_2 = 1.15
|
109 |
+
lora_image_1 = "/valid/path/to/default/image.png" # Updated to a valid image path
|
110 |
+
lora_image_2 = "/valid/path/to/default/image.png" # Updated to a valid image path
|
111 |
if len(selected_indices) >= 1:
|
112 |
lora1 = loras_state[selected_indices[0]]
|
113 |
selected_info_1 = f"### LoRA 1 Selected: [{lora1['title']}](https://huggingface.co/{lora1['repo']}) β¨"
|
|
|
188 |
if repo.endswith(".safetensors") and repo.startswith("http"):
|
189 |
repo = download_file(repo)
|
190 |
new_item = {
|
191 |
+
"image": image if image else "/valid/path/to/default/image.png", # Updated to a valid image path
|
192 |
"title": title,
|
193 |
"repo": repo,
|
194 |
"weights": path,
|
|
|
285 |
with calculateDuration("Generating image"):
|
286 |
# Generate image
|
287 |
for img in pipe(prompt=prompt_mash, num_inference_steps=steps, guidance_scale=cfg_scale, width=width, height=height, generator=generator):
|
288 |
+
if img is not None: # Check for NoneType before yielding
|
289 |
+
yield img
|
290 |
|
291 |
@spaces.GPU(duration=75)
|
292 |
def run_lora(prompt, selected_indices, loras_state):
|
|
|
395 |
history = []
|
396 |
history.insert(0, new_image)
|
397 |
return history
|
398 |
+
|
399 |
css = '''
|
400 |
#gen_btn{height: 100%}
|
401 |
#title{text-align: center}
|