Spaces:
Sleeping
Sleeping
Requirements
Browse files- utils/caption_utils.py +0 -3
utils/caption_utils.py
CHANGED
|
@@ -2,10 +2,8 @@ from transformers import BlipProcessor, BlipForConditionalGeneration, AutoTokeni
|
|
| 2 |
import torch
|
| 3 |
import requests
|
| 4 |
from dotenv import load_dotenv
|
| 5 |
-
from image_utils import UrlTest
|
| 6 |
import os
|
| 7 |
|
| 8 |
-
img = UrlTest()
|
| 9 |
|
| 10 |
class ImageCaptioning:
|
| 11 |
def __init__(self):
|
|
@@ -83,7 +81,6 @@ class ImageCaptioning:
|
|
| 83 |
return [topic for topic in topics if topic and len(topic.split()) > 1]
|
| 84 |
|
| 85 |
def combo_model(self, image, additional_text=None):
|
| 86 |
-
image = img.load_image(image)
|
| 87 |
caption = self.generate_caption(image)
|
| 88 |
caption = self.blip_processor.decode(caption[0], skip_special_tokens=True)
|
| 89 |
topics = self.generate_topics(caption, additional_text)
|
|
|
|
| 2 |
import torch
|
| 3 |
import requests
|
| 4 |
from dotenv import load_dotenv
|
|
|
|
| 5 |
import os
|
| 6 |
|
|
|
|
| 7 |
|
| 8 |
class ImageCaptioning:
|
| 9 |
def __init__(self):
|
|
|
|
| 81 |
return [topic for topic in topics if topic and len(topic.split()) > 1]
|
| 82 |
|
| 83 |
def combo_model(self, image, additional_text=None):
|
|
|
|
| 84 |
caption = self.generate_caption(image)
|
| 85 |
caption = self.blip_processor.decode(caption[0], skip_special_tokens=True)
|
| 86 |
topics = self.generate_topics(caption, additional_text)
|