File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -25,10 +25,21 @@ def inference(model_inputs:dict) -> dict:
2525 prompt = model_inputs .get ('prompt' , None )
2626 if prompt == None :
2727 return {'message' : "No prompt provided" }
28+
29+ height = model_inputs .get ('height' , 512 );
30+ width = model_inputs .get ('width' , 512 );
31+ num_inference_steps = model_inputs .get ('num_inference_steps' , 50 );
32+ guidance_scale = model_inputs .get ('guidance_scale' , 7.5 );
2833
2934 # Run the model
3035 with autocast ("cuda" ):
31- image = model (prompt )["sample" ][0 ]
36+ image = model (
37+ prompt = prompt ,
38+ height = height ,
39+ width = width ,
40+ num_inference_steps = num_inference_steps ,
41+ guidance_scale = guidance_scale ,
42+ )["sample" ][0 ]
3243
3344 buffered = BytesIO ()
3445 image .save (buffered ,format = "JPEG" )
You can’t perform that action at this time.
0 commit comments