visproj commited on
Commit
5fdabc0
·
verified ·
1 Parent(s): e633fef

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -12,12 +12,7 @@ import random
12
  from Gradio_UI import GradioUI
13
  from typing import Optional, Dict, Any
14
 
15
- # Rotating user agents to avoid bot detection
16
- USER_AGENTS = [
17
- "Mozilla/5.0 (Windows NT 10.0; Win64; x64)",
18
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)",
19
- "Mozilla/5.0 (X11; Linux x86_64)",
20
- ]
21
 
22
  def get_rxcui(drug_name: str) -> str:
23
  """Fetches the RxCUI (RxNorm Concept Unique Identifier) for a given drug name."""
@@ -101,6 +96,13 @@ def sig_expander(sig: str) -> str:
101
 
102
  def scrape_amazon_reviews(product_url):
103
  """Scrapes reviews from an Amazon product page (bypassing 503 errors)."""
 
 
 
 
 
 
 
104
  headers = {"User-Agent": random.choice(USER_AGENTS)}
105
  response = requests.get(product_url, headers=headers)
106
 
 
12
  from Gradio_UI import GradioUI
13
  from typing import Optional, Dict, Any
14
 
15
+
 
 
 
 
 
16
 
17
  def get_rxcui(drug_name: str) -> str:
18
  """Fetches the RxCUI (RxNorm Concept Unique Identifier) for a given drug name."""
 
96
 
97
  def scrape_amazon_reviews(product_url):
98
  """Scrapes reviews from an Amazon product page (bypassing 503 errors)."""
99
+
100
+ # Rotating user agents to avoid bot detection
101
+ USER_AGENTS = [
102
+ "Mozilla/5.0 (Windows NT 10.0; Win64; x64)",
103
+ "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)",
104
+ "Mozilla/5.0 (X11; Linux x86_64)",
105
+ ]
106
  headers = {"User-Agent": random.choice(USER_AGENTS)}
107
  response = requests.get(product_url, headers=headers)
108