halimbahae commited on
Commit
59a4fa5
Β·
verified Β·
1 Parent(s): ee27f65

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -63
app.py CHANGED
@@ -16,7 +16,6 @@ else:
16
  pipe = pipe.to(device)
17
 
18
  MAX_SEED = np.iinfo(np.int32).max
19
- MAX_IMAGE_SIZE = 1024
20
 
21
  def infer(prompt, negative_prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps):
22
  if randomize_seed:
@@ -37,21 +36,20 @@ def infer(prompt, negative_prompt, seed, randomize_seed, width, height, guidance
37
  return image
38
 
39
  examples = [
40
- "🌟 Sunset over the Atlas Mountains",
41
- "🏰 Kasbah with traditional Berber architecture",
42
- "πŸš€ Flying carpet in space",
43
- "πŸ¦„ Unicorn riding a camel in the Sahara Desert",
44
- "🎠 Moroccan souk floating in the sky",
45
  ]
46
 
47
  css="""
48
  #col-container {
49
  margin: 0 auto;
50
- max-width: 520px;
51
- color: white;
52
  }
53
  body {
54
- background-color: #003366;
55
  }
56
  """
57
 
@@ -65,7 +63,7 @@ with gr.Blocks(css=css) as demo:
65
  with gr.Column(elem_id="col-container"):
66
  gr.Markdown(f"""
67
  # bibou.jpeg
68
- Generate Moroccan folkloric music, inspired by Moroccan and Amazigh arts. 🎨🎢
69
  Currently running on {power_device}.
70
  """)
71
 
@@ -83,60 +81,22 @@ with gr.Blocks(css=css) as demo:
83
 
84
  result = gr.Image(label="Result", show_label=False)
85
 
86
- with gr.Accordion("Advanced Settings", open=False):
87
-
88
- negative_prompt = gr.Text(
89
- label="Negative prompt",
90
- max_lines=1,
91
- placeholder="Enter a negative prompt",
92
- visible=False,
93
- )
94
-
95
- seed = gr.Slider(
96
- label="Seed",
97
- minimum=0,
98
- maximum=MAX_SEED,
99
- step=1,
100
- value=0,
101
  )
102
-
103
- randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
104
-
105
- with gr.Row():
106
-
107
- width = gr.Slider(
108
- label="Width",
109
- minimum=256,
110
- maximum=MAX_IMAGE_SIZE,
111
- step=32,
112
- value=512,
113
- )
114
-
115
- height = gr.Slider(
116
- label="Height",
117
- minimum=256,
118
- maximum=MAX_IMAGE_SIZE,
119
- step=32,
120
- value=512,
121
- )
122
-
123
- with gr.Row():
124
-
125
- guidance_scale = gr.Slider(
126
- label="Guidance scale",
127
- minimum=0.0,
128
- maximum=10.0,
129
- step=0.1,
130
- value=0.0,
131
- )
132
 
133
- num_inference_steps = gr.Slider(
134
- label="Number of inference steps",
135
- minimum=1,
136
- maximum=12,
137
- step=1,
138
- value=2,
139
- )
140
 
141
  gr.Examples(
142
  examples = examples,
@@ -151,7 +111,7 @@ with gr.Blocks(css=css) as demo:
151
 
152
  run_button.click(
153
  fn = infer,
154
- inputs = [prompt, negative_prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps],
155
  outputs = [result]
156
  )
157
 
 
16
  pipe = pipe.to(device)
17
 
18
  MAX_SEED = np.iinfo(np.int32).max
 
19
 
20
  def infer(prompt, negative_prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps):
21
  if randomize_seed:
 
36
  return image
37
 
38
  examples = [
39
+ "Sunset over the Atlas Mountains",
40
+ "Flying carpet in space",
41
+ "Unicorn riding a camel in the Sahara Desert",
42
+ "Moroccan souk floating in the sky",
 
43
  ]
44
 
45
  css="""
46
  #col-container {
47
  margin: 0 auto;
48
+ max-width: 840px;
49
+ color: #003366;
50
  }
51
  body {
52
+ background-color: white;
53
  }
54
  """
55
 
 
63
  with gr.Column(elem_id="col-container"):
64
  gr.Markdown(f"""
65
  # bibou.jpeg
66
+ Generate Moroccan folkloric pictures, inspired by Moroccan and Amazigh arts. 🎨🎢
67
  Currently running on {power_device}.
68
  """)
69
 
 
81
 
82
  result = gr.Image(label="Result", show_label=False)
83
 
84
+ with gr.Row():
85
+ width = gr.Slider(
86
+ label="Width",
87
+ minimum=512,
88
+ maximum=3000,
89
+ step=32,
90
+ value=512,
 
 
 
 
 
 
 
 
91
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
 
93
+ height = gr.Slider(
94
+ label="Height",
95
+ minimum=512,
96
+ maximum=3000,
97
+ step=32,
98
+ value=512,
99
+ )
100
 
101
  gr.Examples(
102
  examples = examples,
 
111
 
112
  run_button.click(
113
  fn = infer,
114
+ inputs = [prompt, "", 0, True, width, height, 0, 2],
115
  outputs = [result]
116
  )
117