Spaces:
Running
Running
Cleaning up a bit more. Applying proper dataset label.
Browse files
app.py
CHANGED
|
@@ -32,11 +32,7 @@ import torch
|
|
| 32 |
|
| 33 |
|
| 34 |
# AA: Load dataset. Initial image source.
|
| 35 |
-
#
|
| 36 |
-
from datasets import load_dataset
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
#Load dataset (detection-datasets/coco)
|
| 40 |
dataset = load_dataset("henryscheible/coco_val2014_tiny", split="validation")
|
| 41 |
|
| 42 |
|
|
@@ -51,14 +47,12 @@ df = pd.DataFrame(samples)
|
|
| 51 |
# BB: Direct to Photos folder
|
| 52 |
IMAGE_FOLDER = "Photos"
|
| 53 |
|
| 54 |
-
|
| 55 |
image_paths = [
|
| 56 |
os.path.join(IMAGE_FOLDER, f)
|
| 57 |
for f in os.listdir(IMAGE_FOLDER)
|
| 58 |
if f.lower().endswith((".jpg", ".jpeg", ".png"))
|
| 59 |
]
|
| 60 |
|
| 61 |
-
|
| 62 |
#Load the image captioning model (Salesforce/blip-image-captioning-large)
|
| 63 |
processor = BlipProcessor.from_pretrained("Salesforce/blip-image-captioning-large")
|
| 64 |
model = BlipForConditionalGeneration.from_pretrained("Salesforce/blip-image-captioning-large")
|
|
@@ -86,9 +80,7 @@ def caption_random_image():
|
|
| 86 |
# BB: Load into PIL - image from folder - image from folder
|
| 87 |
image = Image.open(img_path).convert("RGB")
|
| 88 |
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
# AA: Image - for DF
|
| 93 |
##image = sample["image"]
|
| 94 |
|
|
|
|
| 32 |
|
| 33 |
|
| 34 |
# AA: Load dataset. Initial image source.
|
| 35 |
+
#Load dataset (henryscheible/coco_val2014_tiny)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
dataset = load_dataset("henryscheible/coco_val2014_tiny", split="validation")
|
| 37 |
|
| 38 |
|
|
|
|
| 47 |
# BB: Direct to Photos folder
|
| 48 |
IMAGE_FOLDER = "Photos"
|
| 49 |
|
|
|
|
| 50 |
image_paths = [
|
| 51 |
os.path.join(IMAGE_FOLDER, f)
|
| 52 |
for f in os.listdir(IMAGE_FOLDER)
|
| 53 |
if f.lower().endswith((".jpg", ".jpeg", ".png"))
|
| 54 |
]
|
| 55 |
|
|
|
|
| 56 |
#Load the image captioning model (Salesforce/blip-image-captioning-large)
|
| 57 |
processor = BlipProcessor.from_pretrained("Salesforce/blip-image-captioning-large")
|
| 58 |
model = BlipForConditionalGeneration.from_pretrained("Salesforce/blip-image-captioning-large")
|
|
|
|
| 80 |
# BB: Load into PIL - image from folder - image from folder
|
| 81 |
image = Image.open(img_path).convert("RGB")
|
| 82 |
|
| 83 |
+
|
|
|
|
|
|
|
| 84 |
# AA: Image - for DF
|
| 85 |
##image = sample["image"]
|
| 86 |
|