KingNish commited on
Commit
cae32b5
1 Parent(s): cd0a2d9

modified: app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
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 should include specifications for resolution (4K, HD, 16:9 aspect ratio), image quality (cute, masterpiece, high-quality, vivid colors, intricate details), and desired art styles (realistic, anime, 3D, logo, futuristic, fantasy). Additionally, consider incorporating themes (e.g. futuristic cityscape, magical forest, abstract art), emotions (e.g. serene, energetic, whimsical), and specific objects or characters (e.g. dragons, robots, landscapes). Ensure the prompt is concise, yet comprehensive, 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=100, 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
 
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