Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -131,17 +131,17 @@ class ConversationBot:
|
|
131 |
print("Outputs:", state)
|
132 |
return state, state, txt + ' ' + audio_filename + ' ', gr.Audio.update(value=audio_filename,visible=True)
|
133 |
else:
|
134 |
-
print("===============Running run_image =============")
|
135 |
-
print("Inputs:", file, state)
|
136 |
-
print("======>Previous memory:\n %s" % self.agent.memory)
|
137 |
image_filename = os.path.join('image', str(uuid.uuid4())[0:8] + ".png")
|
138 |
print("======>Auto Resize Image...")
|
139 |
img = Image.open(file.name)
|
140 |
width, height = img.size
|
141 |
ratio = min(512 / width, 512 / height)
|
142 |
width_new, height_new = (round(width * ratio), round(height * ratio))
|
143 |
-
width_new = int(np.round(width_new / 64.0)) *
|
144 |
-
height_new = int(np.round(height_new / 64.0)) *
|
145 |
img = img.resize((width_new, height_new))
|
146 |
img = img.convert('RGB')
|
147 |
img.save(image_filename, "PNG")
|
@@ -155,7 +155,7 @@ class ConversationBot:
|
|
155 |
state = state + [(f"![](/file={image_filename})*{image_filename}*", AI_prompt)]
|
156 |
print(f"\nProcessed run_image, Input image: {image_filename}\nCurrent state: {state}\n"
|
157 |
f"Current Memory: {self.agent.memory.buffer}")
|
158 |
-
return state, state, txt + '
|
159 |
|
160 |
def inpainting(self, state, audio_filename, image_filename):
|
161 |
print("===============Running inpainting =============")
|
|
|
131 |
print("Outputs:", state)
|
132 |
return state, state, txt + ' ' + audio_filename + ' ', gr.Audio.update(value=audio_filename,visible=True)
|
133 |
else:
|
134 |
+
# print("===============Running run_image =============")
|
135 |
+
# print("Inputs:", file, state)
|
136 |
+
# print("======>Previous memory:\n %s" % self.agent.memory)
|
137 |
image_filename = os.path.join('image', str(uuid.uuid4())[0:8] + ".png")
|
138 |
print("======>Auto Resize Image...")
|
139 |
img = Image.open(file.name)
|
140 |
width, height = img.size
|
141 |
ratio = min(512 / width, 512 / height)
|
142 |
width_new, height_new = (round(width * ratio), round(height * ratio))
|
143 |
+
width_new = int(np.round(width_new / 64.0)) * 64
|
144 |
+
height_new = int(np.round(height_new / 64.0)) * 64
|
145 |
img = img.resize((width_new, height_new))
|
146 |
img = img.convert('RGB')
|
147 |
img.save(image_filename, "PNG")
|
|
|
155 |
state = state + [(f"![](/file={image_filename})*{image_filename}*", AI_prompt)]
|
156 |
print(f"\nProcessed run_image, Input image: {image_filename}\nCurrent state: {state}\n"
|
157 |
f"Current Memory: {self.agent.memory.buffer}")
|
158 |
+
return state, state, txt + f'{txt} {image_filename} ', gr.Audio.update(visible=False)
|
159 |
|
160 |
def inpainting(self, state, audio_filename, image_filename):
|
161 |
print("===============Running inpainting =============")
|