AyushChothe commited on
Commit
6a28ae4
·
1 Parent(s): 6c16da1

unsupported operand type(s) for |: 'type' and '_GenericAlias' Fix

Browse files
Files changed (1) hide show
  1. pipeline.py +3 -3
pipeline.py CHANGED
@@ -1,6 +1,6 @@
1
  import asyncio
2
  from io import BytesIO
3
- from typing import List
4
 
5
  import aiohttp
6
  import numpy as np
@@ -17,7 +17,7 @@ class PreTrainedPipeline:
17
  image = Image.open(BytesIO(await response.read()))
18
  return image
19
 
20
- async def process(self, inputs: str | list[str]) -> List[float]:
21
  if isinstance(inputs, str):
22
  inputs = [inputs]
23
 
@@ -32,7 +32,7 @@ class PreTrainedPipeline:
32
  embedding = np.divide(np.sum(embeddings, axis=0), len(embeddings)).tolist()
33
  return embedding
34
 
35
- def __call__(self, inputs: str | list[str]) -> List[float]:
36
  """
37
  Args:
38
  inputs (:obj:`str`):
 
1
  import asyncio
2
  from io import BytesIO
3
+ from typing import List, Union
4
 
5
  import aiohttp
6
  import numpy as np
 
17
  image = Image.open(BytesIO(await response.read()))
18
  return image
19
 
20
+ async def process(self, inputs: Union[str, List[str]]) -> List[float]:
21
  if isinstance(inputs, str):
22
  inputs = [inputs]
23
 
 
32
  embedding = np.divide(np.sum(embeddings, axis=0), len(embeddings)).tolist()
33
  return embedding
34
 
35
+ def __call__(self, inputs: Union[str, List[str]]) -> List[float]:
36
  """
37
  Args:
38
  inputs (:obj:`str`):