shivanis14 commited on
Commit
2bbc148
1 Parent(s): f08e9b3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -8,10 +8,11 @@ debug_mode = True
8
 
9
  # Initialize OpenAI client
10
  client = OpenAI(api_key=os.getenv("OPENAI_API_KEY")) # Replace with your actual API key
 
11
 
12
- def extract_data_from_product_image(image_links):
13
  #Send product label image url to data extractor
14
- url = "https://data-extractor-67qj89pa0-sonikas-projects-9936eaad.vercel.app/extract"
15
  data = {
16
  "image_links": image_links
17
  }
@@ -28,9 +29,9 @@ def extract_data_from_product_image(image_links):
28
  print(f"Error occurred: {e}")
29
  return {}
30
 
31
- def get_product_data_from_db(product_name):
32
  #Extract data for a product by calling data extractor's API : https://data-extractor-3cn8or2tc-sonikas-projects-9936eaad.vercel.app/
33
- url = "https://data-extractor-3cn8or2tc-sonikas-projects-9936eaad.vercel.app/product"
34
  params = {"name": product_name}
35
 
36
  try:
 
8
 
9
  # Initialize OpenAI client
10
  client = OpenAI(api_key=os.getenv("OPENAI_API_KEY")) # Replace with your actual API key
11
+ data_extractor_url = "https://data-extractor-67qj89pa0-sonikas-projects-9936eaad.vercel.app/"
12
 
13
+ def extract_data_from_product_image(image_links, data_extractor_url):
14
  #Send product label image url to data extractor
15
+ url = data_extractor_url + "extract"
16
  data = {
17
  "image_links": image_links
18
  }
 
29
  print(f"Error occurred: {e}")
30
  return {}
31
 
32
+ def get_product_data_from_db(product_name, data_extractor_url):
33
  #Extract data for a product by calling data extractor's API : https://data-extractor-3cn8or2tc-sonikas-projects-9936eaad.vercel.app/
34
+ url = data_extractor_url + "product"
35
  params = {"name": product_name}
36
 
37
  try: