Spaces:
Sleeping
Sleeping
Update main.py
Browse files172 unmodified lines17317417517617717817912 unmodified lines192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229172 unmodified lines@app.post("/Immagine")def generate_image(request: Request, input_data: InputImage):#client = Client("https://hysts-sd-xl.hf.space/--replicas/cplz0/")client = Client("https://manjushri-sdxl-1-0.hf.space/")if input_data.style:12 unmodified linesattempt = 0while attempt < max_attempts:try:#result = client.predict(# input_data.input, # str in 'Prompt' Textbox component# input_data.negativePrompt, # str in 'Negative prompt' Textbox component# input_data.input, # str in 'Prompt 2' Textbox component# input_data.negativePrompt, # str in 'Negative prompt 2' Textbox component# True, # bool in 'Use negative prompt' Checkbox component# True, # bool in 'Use prompt 2' Checkbox component# True, # bool in 'Use negative prompt 2' Checkbox component# input_data.seed, # float (numeric value between 0 and 2147483647) in 'Seed' Slider component# 1024, # float (numeric value between 256 and 1024) in 'Width' Slider component# 1024, # float (numeric value between 256 and 1024) in 'Height' Slider component# input_data.cfg, # float (numeric value between 1 and 20) in 'Guidance scale for base' Slider component# input_data.cfg, # float (numeric value between 1 and 20) in 'Guidance scale for refiner' Slider component# input_data.steps, # float (numeric value between 10 and 100) in 'Number of inference steps for base' Slider component# input_data.steps, # float (numeric value between 10 and 100) in 'Number of inference steps for refiner' Slider component# True, # bool in 'Apply refiner' Checkbox component# api_name="/run"#)result = client.predict(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 componentinput_data.negativePrompt, # str in 'What you Do Not want the AI to generate. 77 Token Limit' Textbox component1024, # int | float (numeric value between 512 and 1024) in 'Height' Slider component1024, # int | float (numeric value between 512 and 1024) in 'Width' Slider componentinput_data.cfg, # int | float (numeric value between 1 and 15) in 'Guidance Scale: How Closely the AI follows the Prompt' Slider componentinput_data.steps, # int | float (numeric value between 25 and 100) in 'Number of Iterations' Slider component0, # int | float (numeric value between 0 and 999999999999999999) in 'Seed: 0 is Random' Slider component"Yes", # str in 'Upscale?' Radio component"", # str in 'Embedded Prompt' Textbox component"", # str in 'Embedded Negative Prompt' Textbox component0.99, # int | float (numeric value between 0.7 and 0.99) in 'Refiner Denoise Start %' Slider componentinput_data.steps, # int | float (numeric value between 1 and 100) in 'Refiner Number of Iterations %' Slider componentapi_name="/predict")image_url = resultwith open(image_url, 'rb') as img_file:172 unmodified lines17317417517617717812 unmodified lines191192193194195196197198199200201202203204205206207208209210172 unmodified lines@app.post("/Immagine")def generate_image(request: Request, input_data: InputImage):client = Client("https://manjushri-sdxl-1-0.hf.space/")if input_data.style:12 unmodified linesattempt = 0while attempt < max_attempts:try:result = client.predict("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"", # str in 'What you Do Not want the AI to generate. 77 Token Limit' Textbox component1024, # int | float (numeric value between 512 and 1024) in 'Height' Slider component1024, # int | float (numeric value between 512 and 1024) in 'Width' Slider component7, # int | float (numeric value between 1 and 15) in 'Guidance Scale: How Closely the AI follows the Prompt' Slider component30, # int | float (numeric value between 25 and 100) in 'Number of Iterations' Slider component0, # int | float (numeric value between 0 and 999999999999999999) in 'Seed: 0 is Random' Slider component"Yes", # str in 'Upscale?' Radio component"", # str in 'Embedded Prompt' Textbox component"", # str in 'Embedded Negative Prompt' Textbox component0.7, # int | float (numeric value between 0.7 and 0.99) in 'Refiner Denoise Start %' Slider component1, # int | float (numeric value between 1 and 100) in 'Refiner Number of Iterations %' Slider componentapi_name="/predict")image_url = resultwith open(image_url, 'rb') as img_file:
main.py+13-32