lpastor commited on
Commit
0fd8596
1 Parent(s): 2872dd0

Muevo image.json a carpeta images, actualizo .gitignore y ajusto nombres de atributos

Browse files
Files changed (3) hide show
  1. .gitignore +1 -1
  2. images.json → images/images.json +2 -2
  3. main.py +2 -2
.gitignore CHANGED
@@ -1 +1 @@
1
- images
 
1
+ images/*[!.json]
images.json → images/images.json RENAMED
@@ -1,11 +1,11 @@
1
  {
2
  "imagesToUpload": [
3
  {
4
- "path": "images/<name-image-file>",
5
  "text": "<value>"
6
  },
7
  {
8
- "path": "images/<name-image-file>",
9
  "text": "<value>"
10
  }
11
  ]
 
1
  {
2
  "imagesToUpload": [
3
  {
4
+ "name": "<image-file>",
5
  "text": "<value>"
6
  },
7
  {
8
+ "name": "<image-file>",
9
  "text": "<value>"
10
  }
11
  ]
main.py CHANGED
@@ -9,12 +9,12 @@ df = table.to_pandas() # DataFrame
9
 
10
  print("INICIO", df)
11
 
12
- with open("images.json") as json_file:
13
  data = json.load(json_file)
14
  image_rows = data["imagesToUpload"]
15
 
16
  for img in image_rows:
17
- image_path = img["path"]
18
  image_text = img["text"]
19
  with open(image_path, "rb") as image:
20
  image_bytes = image.read()
 
9
 
10
  print("INICIO", df)
11
 
12
+ with open("images/images.json") as json_file:
13
  data = json.load(json_file)
14
  image_rows = data["imagesToUpload"]
15
 
16
  for img in image_rows:
17
+ image_path = f"images/{img["name"]}"
18
  image_text = img["text"]
19
  with open(image_path, "rb") as image:
20
  image_bytes = image.read()