Spaces:
Running
on
Zero
Running
on
Zero
modified: app.py
Browse files
app.py
CHANGED
@@ -52,9 +52,9 @@ pipe_edit.to("cuda")
|
|
52 |
|
53 |
def promptifier(prompt):
|
54 |
client1 = InferenceClient("mistralai/Mistral-7B-Instruct-v0.3")
|
55 |
-
system_instructions1 = "<s>[SYSTEM] Act as Image Prompt Generation expert, Your task is to modify prompt by USER to more better prompt for Image Generation in Stable Diffusion XL. \n Modify the user's prompt to generate a high-quality image by incorporating essential keywords and styles. The optimized prompt
|
56 |
formatted_prompt = f"{system_instructions1} {prompt} [OPTIMIZED_PROMPT]"
|
57 |
-
stream = client1.text_generation(formatted_prompt, max_new_tokens=
|
58 |
return "".join([response.token.text for response in stream if response.token.text != "</s>"])
|
59 |
|
60 |
# Generator
|
|
|
52 |
|
53 |
def promptifier(prompt):
|
54 |
client1 = InferenceClient("mistralai/Mistral-7B-Instruct-v0.3")
|
55 |
+
system_instructions1 = "<s>[SYSTEM] Act as Image Prompt Generation expert, Your task is to modify prompt by USER to more better prompt for Image Generation in Stable Diffusion XL. \n Modify the user's prompt to generate a high-quality image by incorporating essential keywords and styles according to prompt if none style is mentioned than assume realistic. The optimized prompt may include keywords according to prompt for resolution (4K, HD, 16:9 aspect ratio, , etc.), image quality (cute, masterpiece, high-quality, vivid colors, intricate details, etc.), and desired art styles (realistic, anime, 3D, logo, futuristic, fantasy, etc.). Ensure the prompt is concise, yet comprehensive and choose keywords wisely, to generate an exceptional image that meets the user's expectations. \n Your task is to reply with final optimized prompt only. If you get big prompt make it concise.[USER]"
|
56 |
formatted_prompt = f"{system_instructions1} {prompt} [OPTIMIZED_PROMPT]"
|
57 |
+
stream = client1.text_generation(formatted_prompt, max_new_tokens=80, stream=True, details=True, return_full_text=False)
|
58 |
return "".join([response.token.text for response in stream if response.token.text != "</s>"])
|
59 |
|
60 |
# Generator
|