clementruhm commited on
Commit
9e5e755
1 Parent(s): 1124846

Update service_request.py

Browse files
Files changed (1) hide show
  1. service_request.py +2 -2
service_request.py CHANGED
@@ -64,7 +64,7 @@ def create_signature(api_secret: str) -> str:
64
 
65
  async def async_service_request(source_str: str, source: np.ndarray, target: np.ndarray, api_key: str, api_secret: str) -> np.ndarray:
66
 
67
- if not target or len(target) == 0:
68
  return None
69
 
70
  ssl_context = ssl.create_default_context()
@@ -79,7 +79,7 @@ async def async_service_request(source_str: str, source: np.ndarray, target: np.
79
  }
80
  if source_str and len(source_str) > 0:
81
  request_dict["source_str"] = source_str
82
- elif source and len(source) > 0:
83
  request_dict["source"] = base64.b64encode(source.tobytes()).decode("utf-8")
84
  else:
85
  return None
 
64
 
65
  async def async_service_request(source_str: str, source: np.ndarray, target: np.ndarray, api_key: str, api_secret: str) -> np.ndarray:
66
 
67
+ if target is None or len(target) == 0:
68
  return None
69
 
70
  ssl_context = ssl.create_default_context()
 
79
  }
80
  if source_str and len(source_str) > 0:
81
  request_dict["source_str"] = source_str
82
+ elif source is not None and len(source) > 0:
83
  request_dict["source"] = base64.b64encode(source.tobytes()).decode("utf-8")
84
  else:
85
  return None