MatteoScript commited on
Commit
55f56cd
·
verified ·
1 Parent(s): 1e200c7

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +13 -32
main.py CHANGED
@@ -173,7 +173,6 @@ class InputImage(BaseModel):
173
 
174
  @app.post("/Immagine")
175
  def generate_image(request: Request, input_data: InputImage):
176
- #client = Client("https://hysts-sd-xl.hf.space/--replicas/cplz0/")
177
  client = Client("https://manjushri-sdxl-1-0.hf.space/")
178
 
179
  if input_data.style:
@@ -192,38 +191,20 @@ def generate_image(request: Request, input_data: InputImage):
192
  attempt = 0
193
  while attempt < max_attempts:
194
  try:
195
- #result = client.predict(
196
- # input_data.input, # str in 'Prompt' Textbox component
197
- # input_data.negativePrompt, # str in 'Negative prompt' Textbox component
198
- # input_data.input, # str in 'Prompt 2' Textbox component
199
- # input_data.negativePrompt, # str in 'Negative prompt 2' Textbox component
200
- # True, # bool in 'Use negative prompt' Checkbox component
201
- # True, # bool in 'Use prompt 2' Checkbox component
202
- # True, # bool in 'Use negative prompt 2' Checkbox component
203
- # input_data.seed, # float (numeric value between 0 and 2147483647) in 'Seed' Slider component
204
- # 1024, # float (numeric value between 256 and 1024) in 'Width' Slider component
205
- # 1024, # float (numeric value between 256 and 1024) in 'Height' Slider component
206
- # input_data.cfg, # float (numeric value between 1 and 20) in 'Guidance scale for base' Slider component
207
- # input_data.cfg, # float (numeric value between 1 and 20) in 'Guidance scale for refiner' Slider component
208
- # input_data.steps, # float (numeric value between 10 and 100) in 'Number of inference steps for base' Slider component
209
- # input_data.steps, # float (numeric value between 10 and 100) in 'Number of inference steps for refiner' Slider component
210
- # True, # bool in 'Apply refiner' Checkbox component
211
- # api_name="/run"
212
- #)
213
  result = client.predict(
214
- input_data.input, # str in 'What you want the AI to generate. 77 Token Limit. A Token is Any Word, Number, Symbol, or Punctuation. Everything Over 77 Will Be Truncated!' Textbox component
215
- input_data.negativePrompt, # str in 'What you Do Not want the AI to generate. 77 Token Limit' Textbox component
216
- 1024, # int | float (numeric value between 512 and 1024) in 'Height' Slider component
217
- 1024, # int | float (numeric value between 512 and 1024) in 'Width' Slider component
218
- input_data.cfg, # int | float (numeric value between 1 and 15) in 'Guidance Scale: How Closely the AI follows the Prompt' Slider component
219
- input_data.steps, # int | float (numeric value between 25 and 100) in 'Number of Iterations' Slider component
220
- 0, # int | float (numeric value between 0 and 999999999999999999) in 'Seed: 0 is Random' Slider component
221
- "Yes", # str in 'Upscale?' Radio component
222
- "", # str in 'Embedded Prompt' Textbox component
223
- "", # str in 'Embedded Negative Prompt' Textbox component
224
- 0.99, # int | float (numeric value between 0.7 and 0.99) in 'Refiner Denoise Start %' Slider component
225
- input_data.steps, # int | float (numeric value between 1 and 100) in 'Refiner Number of Iterations %' Slider component
226
- api_name="/predict"
227
  )
228
  image_url = result
229
  with open(image_url, 'rb') as img_file:
 
173
 
174
  @app.post("/Immagine")
175
  def generate_image(request: Request, input_data: InputImage):
 
176
  client = Client("https://manjushri-sdxl-1-0.hf.space/")
177
 
178
  if input_data.style:
 
191
  attempt = 0
192
  while attempt < max_attempts:
193
  try:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
194
  result = client.predict(
195
+ "Smiling Dog in a unicorn", # str in 'What you want the AI to generate. 77 Token Limit. A Token is Any Word, Number, Symbol, or Punctuation. Everything Over 77 Will Be Truncated!' Textbox component
196
+ "", # str in 'What you Do Not want the AI to generate. 77 Token Limit' Textbox component
197
+ 1024, # int | float (numeric value between 512 and 1024) in 'Height' Slider component
198
+ 1024, # int | float (numeric value between 512 and 1024) in 'Width' Slider component
199
+ 7, # int | float (numeric value between 1 and 15) in 'Guidance Scale: How Closely the AI follows the Prompt' Slider component
200
+ 30, # int | float (numeric value between 25 and 100) in 'Number of Iterations' Slider component
201
+ 0, # int | float (numeric value between 0 and 999999999999999999) in 'Seed: 0 is Random' Slider component
202
+ "Yes", # str in 'Upscale?' Radio component
203
+ "", # str in 'Embedded Prompt' Textbox component
204
+ "", # str in 'Embedded Negative Prompt' Textbox component
205
+ 0.7, # int | float (numeric value between 0.7 and 0.99) in 'Refiner Denoise Start %' Slider component
206
+ 1, # int | float (numeric value between 1 and 100) in 'Refiner Number of Iterations %' Slider component
207
+ api_name="/predict"
208
  )
209
  image_url = result
210
  with open(image_url, 'rb') as img_file: