suvadityamuk commited on
Commit
e7d8a13
·
1 Parent(s): 7d8ee8d

Signed-off-by: Suvaditya Mukherjee <[email protected]>

Files changed (2) hide show
  1. app.py +1 -1
  2. utils.py +5 -1
app.py CHANGED
@@ -189,7 +189,7 @@ if __name__ == "__main__":
189
  "response_time": time.time() - start_time,
190
  "gpu_memory_used": torch.cuda.memory_allocated() if torch.cuda.is_available() else 0,
191
  "cpu_memory": psutil.Process().memory_info().rss,
192
- "gpu_utilization": torch.cuda.utilization() if torch.cuda.is_available() else 0
193
  }
194
  }
195
  wandb.log(metrics)
 
189
  "response_time": time.time() - start_time,
190
  "gpu_memory_used": torch.cuda.memory_allocated() if torch.cuda.is_available() else 0,
191
  "cpu_memory": psutil.Process().memory_info().rss,
192
+ # "gpu_utilization": torch.cuda.utilization() if torch.cuda.is_available() else 0
193
  }
194
  }
195
  wandb.log(metrics)
utils.py CHANGED
@@ -138,6 +138,10 @@ def scrape_website(start_url, delay=1):
138
  links.append(url)
139
  return links
140
 
 
 
 
 
141
  # Main scraping loop
142
  while queue:
143
  url = queue.popleft()
@@ -146,7 +150,7 @@ def scrape_website(start_url, delay=1):
146
 
147
  try:
148
  print(f"Scraping: {url}")
149
- response = requests.get(url, timeout=10)
150
  response.raise_for_status()
151
 
152
  soup = BeautifulSoup(response.text, 'html.parser')
 
138
  links.append(url)
139
  return links
140
 
141
+ headers = {
142
+ 'User-Agent': 'Mozilla/5.0'
143
+ }
144
+
145
  # Main scraping loop
146
  while queue:
147
  url = queue.popleft()
 
150
 
151
  try:
152
  print(f"Scraping: {url}")
153
+ response = requests.get(url, headers=headers, timeout=10)
154
  response.raise_for_status()
155
 
156
  soup = BeautifulSoup(response.text, 'html.parser')