Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -86,7 +86,6 @@ def parse_descriptions(text):
|
|
| 86 |
seed_words = []
|
| 87 |
|
| 88 |
used_words = set()
|
| 89 |
-
paused = False
|
| 90 |
|
| 91 |
# Queue to store parsed descriptions
|
| 92 |
parsed_descriptions_queue = deque()
|
|
@@ -97,7 +96,6 @@ MAX_IMAGES = 12
|
|
| 97 |
|
| 98 |
@spaces.GPU
|
| 99 |
def generate_descriptions(user_prompt, seed_words_input, batch_size=100, max_iterations=50):
|
| 100 |
-
global paused
|
| 101 |
descriptions = []
|
| 102 |
description_queue = deque()
|
| 103 |
iteration_count = 0
|
|
@@ -114,9 +112,6 @@ def generate_descriptions(user_prompt, seed_words_input, batch_size=100, max_ite
|
|
| 114 |
seed_words.extend(re.findall(r'"(.*?)"', seed_words_input))
|
| 115 |
|
| 116 |
while iteration_count < max_iterations and len(parsed_descriptions_queue) < MAX_DESCRIPTIONS:
|
| 117 |
-
if paused:
|
| 118 |
-
break
|
| 119 |
-
|
| 120 |
# Select a subject that has not been used
|
| 121 |
available_subjects = [word for word in seed_words if word not in used_words]
|
| 122 |
if not available_subjects:
|
|
@@ -169,7 +164,8 @@ def combined_function(user_prompt, seed_words_input):
|
|
| 169 |
return images
|
| 170 |
|
| 171 |
if __name__ == '__main__':
|
| 172 |
-
|
|
|
|
| 173 |
|
| 174 |
interface = gr.Interface(
|
| 175 |
fn=combined_function,
|
|
|
|
| 86 |
seed_words = []
|
| 87 |
|
| 88 |
used_words = set()
|
|
|
|
| 89 |
|
| 90 |
# Queue to store parsed descriptions
|
| 91 |
parsed_descriptions_queue = deque()
|
|
|
|
| 96 |
|
| 97 |
@spaces.GPU
|
| 98 |
def generate_descriptions(user_prompt, seed_words_input, batch_size=100, max_iterations=50):
|
|
|
|
| 99 |
descriptions = []
|
| 100 |
description_queue = deque()
|
| 101 |
iteration_count = 0
|
|
|
|
| 112 |
seed_words.extend(re.findall(r'"(.*?)"', seed_words_input))
|
| 113 |
|
| 114 |
while iteration_count < max_iterations and len(parsed_descriptions_queue) < MAX_DESCRIPTIONS:
|
|
|
|
|
|
|
|
|
|
| 115 |
# Select a subject that has not been used
|
| 116 |
available_subjects = [word for word in seed_words if word not in used_words]
|
| 117 |
if not available_subjects:
|
|
|
|
| 164 |
return images
|
| 165 |
|
| 166 |
if __name__ == '__main__':
|
| 167 |
+
# Ensure CUDA is initialized correctly
|
| 168 |
+
torch.cuda.init()
|
| 169 |
|
| 170 |
interface = gr.Interface(
|
| 171 |
fn=combined_function,
|