oort commited on
Commit
9be2980
·
verified ·
1 Parent(s): 5ec775d

Change response parsing

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -52,7 +52,7 @@ def create_prompt_for_image_generation(user_prompt: str) -> str:
52
  3. Color Palette: Include details about the dominant colors or overall color scheme.
53
  4. Perspective and Camera Details: Mention the point of view (e.g., wide-angle, close-up), camera type, lens, aperture, and lighting conditions if applicable.
54
  5. Additional Details: Highlight any specific objects, text, or unique features with clear emphasis (e.g., 'with green text' or 'emphasis on golden hour lighting').
55
- 6. Output Settings: Suggest aspect ratio, output format (e.g., PNG), quality level, and seed for reproducibility.
56
  Ensure that the generated prompt is logical, descriptive, and written in natural language to maximize compatibility with FLUX-Schnell capabilities.
57
  Example Input:
58
  An image of a serene forest with a small cabin.
@@ -64,7 +64,7 @@ def create_prompt_for_image_generation(user_prompt: str) -> str:
64
  The color palette includes rich greens, warm browns for the cabin, and soft gray mist.
65
  The perspective is slightly elevated as if viewed from a drone camera at sunrise,
66
  capturing golden hour lighting for soft shadows and warm highlights.
67
- The aspect ratio is 1:1, using seed 42 for reproducibility.
68
  """
69
  model = HfApiModel(
70
  max_tokens=384,
@@ -80,8 +80,8 @@ def create_prompt_for_image_generation(user_prompt: str) -> str:
80
  # response = model(
81
  # prompt=prompt, temperature=1., max_tokens=512)
82
  response = model(messages, stop_sequences=["END"])
83
- # return response['choices'][0]['text']
84
- return response
85
 
86
  except Exception as e:
87
  print(f"Error during LLM call: {str(e)}")
 
52
  3. Color Palette: Include details about the dominant colors or overall color scheme.
53
  4. Perspective and Camera Details: Mention the point of view (e.g., wide-angle, close-up), camera type, lens, aperture, and lighting conditions if applicable.
54
  5. Additional Details: Highlight any specific objects, text, or unique features with clear emphasis (e.g., 'with green text' or 'emphasis on golden hour lighting').
55
+ 6. Output Settings: Suggest aspect ratio, output format (e.g., JPG), quality level, and seed for reproducibility.
56
  Ensure that the generated prompt is logical, descriptive, and written in natural language to maximize compatibility with FLUX-Schnell capabilities.
57
  Example Input:
58
  An image of a serene forest with a small cabin.
 
64
  The color palette includes rich greens, warm browns for the cabin, and soft gray mist.
65
  The perspective is slightly elevated as if viewed from a drone camera at sunrise,
66
  capturing golden hour lighting for soft shadows and warm highlights.
67
+ The aspect ratio is 1:1, output format JPG, high quality, using seed 42 for reproducibility.
68
  """
69
  model = HfApiModel(
70
  max_tokens=384,
 
80
  # response = model(
81
  # prompt=prompt, temperature=1., max_tokens=512)
82
  response = model(messages, stop_sequences=["END"])
83
+ return response['choices'][0]['text']
84
+ # return response
85
 
86
  except Exception as e:
87
  print(f"Error during LLM call: {str(e)}")