warhawkmonk commited on
Commit
8ccaac3
·
verified ·
1 Parent(s): e91526e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -3
app.py CHANGED
@@ -87,9 +87,24 @@ def model_single_out(prompt):
87
  return image
88
 
89
  def model_out_put(init_image,mask_image,prompt,negative_prompt):
90
- pipeline_ = load_model()
91
- image = pipeline_(prompt=prompt, negative_prompt=negative_prompt, image=init_image, mask_image=mask_image).images[0]
92
- return image
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
 
94
  @st.cache_resource
95
  def multimodel():
 
87
  return image
88
 
89
  def model_out_put(init_image,mask_image,prompt,negative_prompt):
90
+ API_URL = "https://d5e8-2405-201-802c-f859-c1ff-35e2-34fb-b340.ngrok-free.app/api/llm-response"
91
+ initial_image_base64 = numpy_to_list(np.array(init_image))
92
+ mask_image_base64 = numpy_to_list(np.array(mask_image))
93
+ payload = {
94
+ "prompt": prompt, # Replace with your desired prompt
95
+ "initial_img": initial_image_base64,
96
+ "masked_img": mask_image_base64,
97
+ "negative_prompt": negative_prompt # Replace with your negative prompt
98
+ }
99
+ response = requests.post(API_URL, json=payload)
100
+ response_data = response.json()
101
+ output_image_base64 = response_data.get("img", "")
102
+
103
+ output_image=np.array(output_image_base64,dtype=np.uint8)
104
+
105
+ output_image = Image.fromarray(output_image)
106
+ # output_image.show()
107
+ return output_image
108
 
109
  @st.cache_resource
110
  def multimodel():