thlinhares commited on
Commit
5f57f2b
·
1 Parent(s): 78cd1bd

add user-agent request

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -8,7 +8,10 @@ from transformers import AutoModelForCausalLM, AutoProcessor, GenerationConfig
8
 
9
 
10
  def download_image(url):
11
- resp = requests.get(url)
 
 
 
12
  resp.raise_for_status()
13
  return Image.open(io.BytesIO(resp.content)).convert("RGB")
14
 
 
8
 
9
 
10
  def download_image(url):
11
+ headers = {
12
+ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'
13
+ }
14
+ resp = requests.get(url, headers=headers)
15
  resp.raise_for_status()
16
  return Image.open(io.BytesIO(resp.content)).convert("RGB")
17