Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -103,7 +103,7 @@ def load_model():
|
|
103 |
pipeline_ = AutoPipelineForInpainting.from_pretrained("kandinsky-community/kandinsky-2-2-decoder-inpaint", torch_dtype=torch.float16).to("cuda")
|
104 |
return pipeline_
|
105 |
|
106 |
-
|
107 |
def prompt_improvment(pre_prompt):
|
108 |
|
109 |
enhancement="Please use details from the prompt mentioned above, focusing only what user is thinking with the prompt and also add 8k resolution. Its a request only provide image description and brief prompt no other text."
|
@@ -165,16 +165,16 @@ def model_out_put(init_image,mask_image,prompt,negative_prompt):
|
|
165 |
# output_image.show()
|
166 |
return output_image
|
167 |
|
168 |
-
|
169 |
-
#
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
|
179 |
@st.cache_resource
|
180 |
def multimodel():
|
|
|
103 |
pipeline_ = AutoPipelineForInpainting.from_pretrained("kandinsky-community/kandinsky-2-2-decoder-inpaint", torch_dtype=torch.float16).to("cuda")
|
104 |
return pipeline_
|
105 |
|
106 |
+
@st.cache_resource
|
107 |
def prompt_improvment(pre_prompt):
|
108 |
|
109 |
enhancement="Please use details from the prompt mentioned above, focusing only what user is thinking with the prompt and also add 8k resolution. Its a request only provide image description and brief prompt no other text."
|
|
|
165 |
# output_image.show()
|
166 |
return output_image
|
167 |
|
168 |
+
def model_out_put(init_image, mask_image, prompt, negative_prompt):
|
169 |
+
# Run the inpainting pipeline
|
170 |
+
pipeline_ = load_model()
|
171 |
+
image = pipeline_(
|
172 |
+
prompt=prompt,
|
173 |
+
negative_prompt=negative_prompt,
|
174 |
+
image=init_image,
|
175 |
+
mask_image=mask_image
|
176 |
+
).images[0]
|
177 |
+
return image
|
178 |
|
179 |
@st.cache_resource
|
180 |
def multimodel():
|