logo
Browse Source

change models folder name.

Signed-off-by: wxywb <xy.wang@zilliz.com>
main
wxywb 2 years ago
parent
commit
f500633fed
  1. 6
      README.md
  2. 2
      clipcap.py
  3. 0
      clipcap_model/__init__.py
  4. 0
      clipcap_model/clipcap.py

6
README.md

@ -69,16 +69,14 @@ Create the operator via the following factory method
## Interface ## Interface
An image-text embedding operator takes a [towhee image](link/to/towhee/image/api/doc) as input and generate the correspoing caption.
An image captioning operator takes a [towhee image](link/to/towhee/image/api/doc) as input and generate the correspoing caption.
**Parameters:** **Parameters:**
***data:*** *towhee.types.Image (a sub-class of numpy.ndarray)* ***data:*** *towhee.types.Image (a sub-class of numpy.ndarray)*
​ The image to generate embedding.
​ The image to generate caption.
**Returns:** *str* **Returns:** *str*

2
clipcap.py

@ -33,7 +33,7 @@ class ClipCap(NNOperator):
def __init__(self, model_name: str): def __init__(self, model_name: str):
super().__init__() super().__init__()
sys.path.append(str(Path(__file__).parent)) sys.path.append(str(Path(__file__).parent))
from models.clipcap import ClipCaptionModel, generate_beam
from clipcap_model.clipcap import ClipCaptionModel, generate_beam
self.device = "cuda" if torch.cuda.is_available() else "cpu" self.device = "cuda" if torch.cuda.is_available() else "cpu"
self.generate_beam = generate_beam self.generate_beam = generate_beam
self.tokenizer = GPT2Tokenizer.from_pretrained("gpt2") self.tokenizer = GPT2Tokenizer.from_pretrained("gpt2")

0
clipcap_model/__init__.py

0
models/clipcap.py → clipcap_model/clipcap.py

Loading…
Cancel
Save