Tobias Geisler commited on
Commit
3837c32
·
1 Parent(s): 5784688

more options

Browse files
Files changed (1) hide show
  1. app.py +15 -4
app.py CHANGED
@@ -8,9 +8,9 @@ client = OpenAI()
8
  if client.api_key is None:
9
  raise ValueError("Die Umgebungsvariable OPENAI_API_KEY ist nicht gesetzt.")
10
 
11
- def generate_image(hair_color, mood, eye_color):
12
  # Constructing the prompt based on user input
13
- prompt = f"Create a beautiful artistic profile picture of a person with {hair_color} hair, {eye_color} eyes, and looks {mood}."
14
 
15
  # Displaying the prompt to the user
16
  print("Prompt:", prompt)
@@ -32,13 +32,24 @@ def generate_image(hair_color, mood, eye_color):
32
  print("An error occurred:", e)
33
  return "An error occurred while generating the image.", None
34
 
 
 
 
 
 
35
  # Define the Gradio interface
36
  iface = gr.Interface(
37
  fn=generate_image,
38
- inputs=[gr.Textbox(label="Hair Color"), gr.Textbox(label="Mood"), gr.Textbox(label="Eye Color")],
 
 
 
 
 
 
39
  outputs=[gr.Text(label="Prompt"), gr.Image(label="Generated Image")],
40
  title="Profile Picture Generator",
41
- description="Enter the hair color, mood, and eye color to generate a profile picture."
42
  )
43
 
44
  # Run the Gradio app
 
8
  if client.api_key is None:
9
  raise ValueError("Die Umgebungsvariable OPENAI_API_KEY ist nicht gesetzt.")
10
 
11
+ def generate_image(hair_color, eye_color, person, age, style):
12
  # Constructing the prompt based on user input
13
+ prompt = f"Create a beautiful artistic profile picture of a smiling {age} year-old {person} with {hair_color} hair, {eye_color} eyes. Style: {style}."
14
 
15
  # Displaying the prompt to the user
16
  print("Prompt:", prompt)
 
32
  print("An error occurred:", e)
33
  return "An error occurred while generating the image.", None
34
 
35
+ hair_color_options = ["Black", "Brown", "Blonde", "Red", "Gray", "White", "Green", "Rainbow", "Blue"]
36
+ eye_color_options = ["Blue", "Brown", "Green", "Gray", "Hazel"]
37
+ person_options = ["Boy", "Girl"]
38
+ style_options = ["Fortnite Character", "3D Pixar Render", "Picasso Painting", "Van Gogh Painting", "Abstract Art", "Realistic Portrait"]
39
+
40
  # Define the Gradio interface
41
  iface = gr.Interface(
42
  fn=generate_image,
43
+ inputs=[
44
+ gr.Dropdown(choices=hair_color_options, label="Hair Color"),
45
+ gr.Dropdown(choices=eye_color_options, label="Eye Color"),
46
+ gr.Dropdown(choices=person_options, label="Person"),
47
+ gr.Number(label="Age", default=12, step=1, precision=0),
48
+ gr.Dropdown(choices=style_options, label="style"),
49
+ ],
50
  outputs=[gr.Text(label="Prompt"), gr.Image(label="Generated Image")],
51
  title="Profile Picture Generator",
52
+ description="Enter the attributes for your profile picture."
53
  )
54
 
55
  # Run the Gradio app