akhaliq HF Staff commited on
Commit
d8b4140
·
1 Parent(s): 3b7c628

fix: access file path using dictionary key instead of attribute in image processing functions

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -231,7 +231,7 @@ async def homepage():
231
  @app.api()
232
  def preprocess(image: FileData) -> FileData:
233
  init_models()
234
- img = Image.open(image.path)
235
  processed = pipeline.preprocess_image(img)
236
  out_path = os.path.join(TMP_DIR, f"preprocessed_{int(time.time()*1000)}.png")
237
  processed.save(out_path)
@@ -260,7 +260,7 @@ def generate_3d(
260
  torch.manual_seed(seed)
261
  hr_resolution = int(resolution)
262
 
263
- img = Image.open(image.path)
264
  image_preprocessed = pipeline.preprocess_image(img)
265
  temp_processed_path = os.path.join(TMP_DIR, "temp_proc.png")
266
  image_preprocessed.save(temp_processed_path)
 
231
  @app.api()
232
  def preprocess(image: FileData) -> FileData:
233
  init_models()
234
+ img = Image.open(image["path"])
235
  processed = pipeline.preprocess_image(img)
236
  out_path = os.path.join(TMP_DIR, f"preprocessed_{int(time.time()*1000)}.png")
237
  processed.save(out_path)
 
260
  torch.manual_seed(seed)
261
  hr_resolution = int(resolution)
262
 
263
+ img = Image.open(image["path"])
264
  image_preprocessed = pipeline.preprocess_image(img)
265
  temp_processed_path = os.path.join(TMP_DIR, "temp_proc.png")
266
  image_preprocessed.save(temp_processed_path)