Spaces:
Running
Running
Update clothGen.py
Browse files- clothGen.py +5 -5
clothGen.py
CHANGED
@@ -18,23 +18,23 @@ def cloth_gen(advice, gender):
|
|
18 |
lora_path = "https://huggingface.co/PPSharks/PPSharksModels/resolve/main/NV.safetensors"
|
19 |
|
20 |
prompt = prompt_gen(advice, gender)
|
21 |
-
start_index = prompt.find("
|
22 |
if start_index == -1:
|
23 |
-
start_index = prompt.find("
|
24 |
intro_index = prompt.find("服饰风格介绍")
|
25 |
cloth_intro = ""
|
26 |
promptGen = ""
|
27 |
if start_index != -1:
|
28 |
-
start_index += len("
|
29 |
end_index = prompt.find("End" or "end")
|
30 |
if end_index != -1:
|
31 |
extracted_content = prompt[start_index:end_index]
|
32 |
promptGen = extracted_content
|
33 |
print(extracted_content)
|
34 |
else:
|
35 |
-
print("No '
|
36 |
else:
|
37 |
-
print("No '
|
38 |
if intro_index != -1:
|
39 |
intro_index += len("服饰风格介绍\n")
|
40 |
cloth_intro = ("汉服,是汉民族的传统服饰。又称衣冠、衣裳、汉装。汉服是中国“衣冠上国”“礼仪之邦”“锦绣中华”的体现,承载了中国的染织绣等杰出"
|
|
|
18 |
lora_path = "https://huggingface.co/PPSharks/PPSharksModels/resolve/main/NV.safetensors"
|
19 |
|
20 |
prompt = prompt_gen(advice, gender)
|
21 |
+
start_index = prompt.find("Begin")
|
22 |
if start_index == -1:
|
23 |
+
start_index = prompt.find("begin")
|
24 |
intro_index = prompt.find("服饰风格介绍")
|
25 |
cloth_intro = ""
|
26 |
promptGen = ""
|
27 |
if start_index != -1:
|
28 |
+
start_index += len("Begin\n")
|
29 |
end_index = prompt.find("End" or "end")
|
30 |
if end_index != -1:
|
31 |
extracted_content = prompt[start_index:end_index]
|
32 |
promptGen = extracted_content
|
33 |
print(extracted_content)
|
34 |
else:
|
35 |
+
print("No 'End' found after 'Begin'.")
|
36 |
else:
|
37 |
+
print("No 'Begin' found in the text.")
|
38 |
if intro_index != -1:
|
39 |
intro_index += len("服饰风格介绍\n")
|
40 |
cloth_intro = ("汉服,是汉民族的传统服饰。又称衣冠、衣裳、汉装。汉服是中国“衣冠上国”“礼仪之邦”“锦绣中华”的体现,承载了中国的染织绣等杰出"
|