Spaces:
Running on Zero
Running on Zero
fix: resolve attribute access error for input_image and export demo instance in app.py
Browse files
app.py
CHANGED
|
@@ -177,7 +177,7 @@ def edit_image(
|
|
| 177 |
if input_image is None:
|
| 178 |
raise ValueError("Please upload an image.")
|
| 179 |
|
| 180 |
-
image = Image.open(input_image
|
| 181 |
|
| 182 |
# Validate aspect ratio
|
| 183 |
w, h = image.size
|
|
@@ -205,7 +205,7 @@ def edit_image(
|
|
| 205 |
true_cfg_scale=guidance_scale,
|
| 206 |
).images[0]
|
| 207 |
|
| 208 |
-
output_path = input_image
|
| 209 |
result.save(output_path)
|
| 210 |
return FileData(path=output_path)
|
| 211 |
finally:
|
|
@@ -226,5 +226,7 @@ async def homepage():
|
|
| 226 |
async def get_loras():
|
| 227 |
return sorted(list(LORA_CONFIGS.keys()))
|
| 228 |
|
|
|
|
|
|
|
| 229 |
if __name__ == "__main__":
|
| 230 |
app.launch(show_error=True)
|
|
|
|
| 177 |
if input_image is None:
|
| 178 |
raise ValueError("Please upload an image.")
|
| 179 |
|
| 180 |
+
image = Image.open(input_image["path"]).convert("RGB")
|
| 181 |
|
| 182 |
# Validate aspect ratio
|
| 183 |
w, h = image.size
|
|
|
|
| 205 |
true_cfg_scale=guidance_scale,
|
| 206 |
).images[0]
|
| 207 |
|
| 208 |
+
output_path = input_image["path"].rsplit(".", 1)[0] + "_edited.png"
|
| 209 |
result.save(output_path)
|
| 210 |
return FileData(path=output_path)
|
| 211 |
finally:
|
|
|
|
| 226 |
async def get_loras():
|
| 227 |
return sorted(list(LORA_CONFIGS.keys()))
|
| 228 |
|
| 229 |
+
demo = app
|
| 230 |
+
|
| 231 |
if __name__ == "__main__":
|
| 232 |
app.launch(show_error=True)
|