Spaces:
Running
Running
Update main.py
Browse files
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 |
-
|
190 |
-
max_attempts = 20
|
191 |
attempt = 0
|
192 |
while attempt < max_attempts:
|
193 |
try:
|
194 |
result = client.predict(
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
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"}
|