Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -56,8 +56,7 @@ def promptifier(prompt):
|
|
56 |
system_instructions1 = "<s>[SYSTEM] Your task is to modify prompt by USER to more better prompt for Image Generation in Stable Diffusion XL, reply with prompt only, Your task is to reply with final prompt in SDXL image generation format only. [USER]"
|
57 |
formatted_prompt = f"{system_instructions1} {prompt} [FINAL_PROMPT]"
|
58 |
stream = client1.text_generation(formatted_prompt, max_new_tokens=80, stream=True, details=True, return_full_text=False)
|
59 |
-
|
60 |
-
return instructions
|
61 |
|
62 |
# Generator
|
63 |
@spaces.GPU(duration=30, queue=False)
|
@@ -111,8 +110,9 @@ def king(type ,
|
|
111 |
else:
|
112 |
guidance_scale2=(guidance_scale/2)
|
113 |
if enhance_prompt:
|
|
|
114 |
instruction = promptifier(instruction)
|
115 |
-
|
116 |
image = pipe( prompt = instruction,
|
117 |
negative_prompt=negative_prompt,
|
118 |
guidance_scale = guidance_scale2,
|
|
|
56 |
system_instructions1 = "<s>[SYSTEM] Your task is to modify prompt by USER to more better prompt for Image Generation in Stable Diffusion XL, reply with prompt only, Your task is to reply with final prompt in SDXL image generation format only. [USER]"
|
57 |
formatted_prompt = f"{system_instructions1} {prompt} [FINAL_PROMPT]"
|
58 |
stream = client1.text_generation(formatted_prompt, max_new_tokens=80, stream=True, details=True, return_full_text=False)
|
59 |
+
return "".join([response.token.text for response in stream if response.token.text != "</s>"])
|
|
|
60 |
|
61 |
# Generator
|
62 |
@spaces.GPU(duration=30, queue=False)
|
|
|
110 |
else:
|
111 |
guidance_scale2=(guidance_scale/2)
|
112 |
if enhance_prompt:
|
113 |
+
print(f"BEFORE: {instruction} ")
|
114 |
instruction = promptifier(instruction)
|
115 |
+
print(f"AFTER: {instruction} ")
|
116 |
image = pipe( prompt = instruction,
|
117 |
negative_prompt=negative_prompt,
|
118 |
guidance_scale = guidance_scale2,
|