Alexandros Popov commited on
Commit
9b232e0
·
1 Parent(s): 94bbb76
Files changed (1) hide show
  1. app.py +6 -11
app.py CHANGED
@@ -1,5 +1,3 @@
1
- import contextlib
2
- import io
3
  import os
4
  import tempfile
5
 
@@ -17,20 +15,17 @@ def process_image_with_agents(image: Image.Image, prompt: str):
17
 
18
  yield [image], "Original image uploaded. Starting enhancement…"
19
 
20
- log_buffer = io.StringIO()
21
- with contextlib.redirect_stdout(log_buffer), contextlib.redirect_stderr(log_buffer):
22
- _ = run_photo_enchancement_agent(
23
- prompt,
24
- image_path=input_path,
25
- output_directory=output_directory,
26
- )
27
 
28
  # Find all images in temp_dir (sorted by name)
29
  image_files = sorted([os.path.join(temp_dir, f) for f in os.listdir(temp_dir) if f.endswith((".jpg", ".png"))])
30
  images = [Image.open(p) for p in image_files]
31
 
32
- logs = log_buffer.getvalue()
33
- yield images, f"✅ Enhancement finished.\n\n--- Agent Logs ---\n{logs}"
34
 
35
 
36
  with gr.Blocks(title="AI Art Director • Agent Workflow") as demo:
 
 
 
1
  import os
2
  import tempfile
3
 
 
15
 
16
  yield [image], "Original image uploaded. Starting enhancement…"
17
 
18
+ run_photo_enchancement_agent(
19
+ prompt,
20
+ image_path=input_path,
21
+ output_directory=output_directory,
22
+ )
 
 
23
 
24
  # Find all images in temp_dir (sorted by name)
25
  image_files = sorted([os.path.join(temp_dir, f) for f in os.listdir(temp_dir) if f.endswith((".jpg", ".png"))])
26
  images = [Image.open(p) for p in image_files]
27
 
28
+ yield images, "Enhancement finished."
 
29
 
30
 
31
  with gr.Blocks(title="AI Art Director • Agent Workflow") as demo: