DanielPFlorian commited on
Commit
e3c1c26
·
1 Parent(s): 6edc1b2

Change Path

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -104,7 +104,7 @@ def process_image(img_path):
104
  """
105
  inp = Image.open(img_path)
106
  inp.load()
107
- exif = inp.getexif()
108
 
109
  # Get image size
110
  w, h = inp.size
@@ -115,15 +115,14 @@ def process_image(img_path):
115
  # Remove non alphanumeric characters
116
  image_path = str(datetime.now())
117
  image_path = re.sub(r"\W+", "_", image_path)
118
- image_path = image_path + ".jpg"
119
 
120
  # Join to directory path
121
  inf_image = os.path.join("inference", image_path)
122
 
123
  # Use repo for inference
124
- inp.save(inf_image, quality=95, keep=True, exif=exif)
125
  HfApi().upload_file(
126
- path_or_fileobj=inf_image,
127
  path_in_repo=image_path,
128
  repo_id="DanielPFlorian/flower-image-classifier",
129
  repo_type="dataset",
 
104
  """
105
  inp = Image.open(img_path)
106
  inp.load()
107
+ img_exif = inp.getexif()
108
 
109
  # Get image size
110
  w, h = inp.size
 
115
  # Remove non alphanumeric characters
116
  image_path = str(datetime.now())
117
  image_path = re.sub(r"\W+", "_", image_path)
 
118
 
119
  # Join to directory path
120
  inf_image = os.path.join("inference", image_path)
121
 
122
  # Use repo for inference
123
+ inp.save(inf_image, format="JPEG", quality=95, keep=True, exif=img_exif)
124
  HfApi().upload_file(
125
+ path_or_fileobj=inf_image + ".JPG",
126
  path_in_repo=image_path,
127
  repo_id="DanielPFlorian/flower-image-classifier",
128
  repo_type="dataset",