codic commited on
Commit
96e5cb1
·
verified ·
1 Parent(s): f6e66c3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -5
app.py CHANGED
@@ -1,4 +1,3 @@
1
- import base64
2
  from gradio_client import Client
3
  from transformers import DPTImageProcessor, DPTForDepthEstimation
4
  import torch
@@ -24,10 +23,8 @@ def process_image(image_path, depth_map_path=None):
24
  Image.Resampling.LANCZOS,
25
  )
26
 
27
- # Send image as a file directly to the Gradio Client for background removal
28
- with open(image_path, 'rb') as image_file:
29
- result = client.predict(image_file, api_name="/png", file=True)
30
-
31
  subject_image = Image.open(result[0]) # Processed PNG with transparent background
32
 
33
  if depth_map_path:
 
 
1
  from gradio_client import Client
2
  from transformers import DPTImageProcessor, DPTForDepthEstimation
3
  import torch
 
23
  Image.Resampling.LANCZOS,
24
  )
25
 
26
+ # Handle background removal via Gradio Client using file path
27
+ result = client.predict(image_path, api_name="/png")
 
 
28
  subject_image = Image.open(result[0]) # Processed PNG with transparent background
29
 
30
  if depth_map_path: