AyushChothe commited on
Commit
d63713d
·
1 Parent(s): 3eb2415

Download image updated

Browse files
Files changed (1) hide show
  1. pipeline.py +5 -2
pipeline.py CHANGED
@@ -1,5 +1,5 @@
1
  from typing import List, Union
2
- from urllib.request import urlopen
3
 
4
  import numpy as np
5
  from fashion_clip.fashion_clip import FashionCLIP
@@ -11,7 +11,10 @@ class PreTrainedPipeline:
11
  self.model = FashionCLIP("fashion-clip")
12
 
13
  def _download_image(self, url) -> Image:
14
- image = Image.open(urlopen(url))
 
 
 
15
  return image
16
 
17
  def process(self, inputs: Union[str, List[str]]) -> List[float]:
 
1
  from typing import List, Union
2
+ from urllib.request import Request, urlopen
3
 
4
  import numpy as np
5
  from fashion_clip.fashion_clip import FashionCLIP
 
11
  self.model = FashionCLIP("fashion-clip")
12
 
13
  def _download_image(self, url) -> Image:
14
+ user_agent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7"
15
+ headers = {"User-Agent": user_agent}
16
+ request = Request(url, None, headers)
17
+ image = Image.open(urlopen(request))
18
  return image
19
 
20
  def process(self, inputs: Union[str, List[str]]) -> List[float]: