MatteoScript commited on
Commit
ad9c967
·
verified ·
1 Parent(s): 586a47b

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +15 -16
main.py CHANGED
@@ -186,25 +186,24 @@ def generate_image(request: Request, input_data: InputImage):
186
  style_info = style_image[input_data.style]
187
  input_data.input = style_info["descrizione"].format(prompt=input_data.input)
188
  input_data.negativePrompt = style_info["negativePrompt"]
189
- print(input_data.input)
190
- max_attempts = 20
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[0]
210
  print(image_url)
@@ -234,4 +233,4 @@ def generate_image(request: Request, input_data: PostSpazio):
234
 
235
  @app.get("/")
236
  def read_general():
237
- return {"response": "Benvenuto. Per maggiori info: https://matteoscript-fastapi.hf.space/docs"}
 
186
  style_info = style_image[input_data.style]
187
  input_data.input = style_info["descrizione"].format(prompt=input_data.input)
188
  input_data.negativePrompt = style_info["negativePrompt"]
189
+ max_attempts = 2
 
190
  attempt = 0
191
  while attempt < max_attempts:
192
  try:
193
  result = client.predict(
194
+ 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
195
+ input_data.negativePrompt, # str in 'What you Do Not want the AI to generate. 77 Token Limit' Textbox component
196
+ 1024, # int | float (numeric value between 512 and 1024) in 'Height' Slider component
197
+ 1024, # int | float (numeric value between 512 and 1024) in 'Width' Slider component
198
+ input_data.cfg, # int | float (numeric value between 1 and 15) in 'Guidance Scale: How Closely the AI follows the Prompt' Slider component
199
+ input_data.steps, # int | float (numeric value between 25 and 100) in 'Number of Iterations' Slider component
200
+ 0, # int | float (numeric value between 0 and 999999999999999999) in 'Seed: 0 is Random' Slider component
201
+ "Yes", # str in 'Upscale?' Radio component
202
+ "", # str in 'Embedded Prompt' Textbox component
203
+ "", # str in 'Embedded Negative Prompt' Textbox component
204
+ 0.99, # int | float (numeric value between 0.7 and 0.99) in 'Refiner Denoise Start %' Slider component
205
+ 100, # int | float (numeric value between 1 and 100) in 'Refiner Number of Iterations %' Slider component
206
+ api_name="/predict"
207
  )
208
  image_url = result[0]
209
  print(image_url)
 
233
 
234
  @app.get("/")
235
  def read_general():
236
+ return {"response": "Benvenuto. Per maggiori info: https://matteoscript-fastapi.hf.space/docs"}