Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -140,6 +140,8 @@ class ConversationBot:
|
|
| 140 |
width, height = img.size
|
| 141 |
ratio = min(512 / width, 512 / height)
|
| 142 |
width_new, height_new = (round(width * ratio), round(height * ratio))
|
|
|
|
|
|
|
| 143 |
img = img.resize((width_new, height_new))
|
| 144 |
img = img.convert('RGB')
|
| 145 |
img.save(image_filename, "PNG")
|
|
@@ -148,7 +150,8 @@ class ConversationBot:
|
|
| 148 |
self.agent.memory.buffer = self.agent.memory.buffer + 'AI: ' + AI_prompt
|
| 149 |
print("======>Current memory:\n %s" % self.agent.memory)
|
| 150 |
state = state + [(f"*{image_filename}*", AI_prompt)]
|
| 151 |
-
print("
|
|
|
|
| 152 |
return state, state, txt + ' ' + image_filename + ' ', gr.Audio.update(visible=False)
|
| 153 |
|
| 154 |
def inpainting(self, state, audio_filename, image_filename):
|
|
@@ -207,10 +210,12 @@ if __name__ == '__main__':
|
|
| 207 |
with gr.Row(visible = False) as input_raws:
|
| 208 |
with gr.Column(scale=0.7):
|
| 209 |
txt = gr.Textbox(show_label=False, placeholder="Enter text and press enter, or upload an image").style(container=False)
|
| 210 |
-
with gr.Column(scale=0.
|
| 211 |
-
|
| 212 |
-
with gr.Column(scale=0.
|
| 213 |
-
|
|
|
|
|
|
|
| 214 |
with gr.Row():
|
| 215 |
with gr.Column():
|
| 216 |
outaudio = gr.Audio(visible=False)
|
|
|
|
| 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")
|
|
|
|
| 150 |
self.agent.memory.buffer = self.agent.memory.buffer + 'AI: ' + AI_prompt
|
| 151 |
print("======>Current memory:\n %s" % self.agent.memory)
|
| 152 |
state = state + [(f"*{image_filename}*", AI_prompt)]
|
| 153 |
+
print(f"\nProcessed run_image, Input image: {image_filename}\nCurrent state: {state}\n"
|
| 154 |
+
f"Current Memory: {self.agent.memory.buffer}")
|
| 155 |
return state, state, txt + ' ' + image_filename + ' ', gr.Audio.update(visible=False)
|
| 156 |
|
| 157 |
def inpainting(self, state, audio_filename, image_filename):
|
|
|
|
| 210 |
with gr.Row(visible = False) as input_raws:
|
| 211 |
with gr.Column(scale=0.7):
|
| 212 |
txt = gr.Textbox(show_label=False, placeholder="Enter text and press enter, or upload an image").style(container=False)
|
| 213 |
+
with gr.Column(scale=0.1, min_width=0):
|
| 214 |
+
run = gr.Button("🏃♂️Run")
|
| 215 |
+
with gr.Column(scale=0.1, min_width=0):
|
| 216 |
+
clear = gr.Button("🔄Clear️")
|
| 217 |
+
with gr.Column(scale=0.1, min_width=0):
|
| 218 |
+
btn = gr.UploadButton("🖼️Upload", file_types=["image","audio"])
|
| 219 |
with gr.Row():
|
| 220 |
with gr.Column():
|
| 221 |
outaudio = gr.Audio(visible=False)
|