Spaces:
Running
on
L40S
Running
on
L40S
Commit
•
349bdb0
1
Parent(s):
a08da6d
Update app.py
Browse files
app.py
CHANGED
@@ -13,6 +13,11 @@ import copy
|
|
13 |
import random
|
14 |
import time
|
15 |
import requests
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
# Load LoRAs from JSON file
|
18 |
with open('loras.json', 'r') as f:
|
@@ -191,7 +196,8 @@ def randomize_loras(selected_indices):
|
|
191 |
lora_scale_2 = 0.95
|
192 |
lora_image_1 = lora1['image']
|
193 |
lora_image_2 = lora2['image']
|
194 |
-
|
|
|
195 |
|
196 |
@spaces.GPU(duration=70)
|
197 |
def generate_image(prompt_mash, steps, seed, cfg_scale, width, height, progress):
|
@@ -570,7 +576,7 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css, delete_cache=(60, 3600)) as app:
|
|
570 |
randomize_button.click(
|
571 |
randomize_loras,
|
572 |
inputs=[selected_indices],
|
573 |
-
outputs=[selected_info_1, selected_info_2, selected_indices, lora_scale_1, lora_scale_2, lora_image_1, lora_image_2]
|
574 |
)
|
575 |
add_custom_lora_button.click(
|
576 |
add_custom_lora,
|
|
|
13 |
import random
|
14 |
import time
|
15 |
import requests
|
16 |
+
import pandas as pd
|
17 |
+
|
18 |
+
#Load prompts for randomization
|
19 |
+
df = pd.read_csv('prompts.csv', header=None)
|
20 |
+
prompt_values = df.values.flatten()
|
21 |
|
22 |
# Load LoRAs from JSON file
|
23 |
with open('loras.json', 'r') as f:
|
|
|
196 |
lora_scale_2 = 0.95
|
197 |
lora_image_1 = lora1['image']
|
198 |
lora_image_2 = lora2['image']
|
199 |
+
random_prompt = random.choice(prompt_values)
|
200 |
+
return selected_info_1, selected_info_2, selected_indices, lora_scale_1, lora_scale_2, lora_image_1, lora_image_2, random_prompt
|
201 |
|
202 |
@spaces.GPU(duration=70)
|
203 |
def generate_image(prompt_mash, steps, seed, cfg_scale, width, height, progress):
|
|
|
576 |
randomize_button.click(
|
577 |
randomize_loras,
|
578 |
inputs=[selected_indices],
|
579 |
+
outputs=[selected_info_1, selected_info_2, selected_indices, lora_scale_1, lora_scale_2, lora_image_1, lora_image_2, prompt]
|
580 |
)
|
581 |
add_custom_lora_button.click(
|
582 |
add_custom_lora,
|