selvaonline commited on
Commit
a6565d8
·
verified ·
1 Parent(s): b1b6f63

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -129,15 +129,13 @@ except Exception as e:
129
  print(f"Error loading recommended models: {str(e)}")
130
  print("Falling back to local model")
131
 
132
- model_id = "selvaonline/shopping-assistant"
133
- tokenizer = AutoTokenizer.from_pretrained(model_id)
134
- model = AutoModelForSequenceClassification.from_pretrained(model_id)
135
 
136
  # Load the local categories
137
  try:
138
- from huggingface_hub import hf_hub_download
139
- categories_path = hf_hub_download(repo_id=model_id, filename="categories.json")
140
- with open(categories_path, "r") as f:
141
  categories = json.load(f)
142
  except Exception as e:
143
  print(f"Error loading categories: {str(e)}")
 
129
  print(f"Error loading recommended models: {str(e)}")
130
  print("Falling back to local model")
131
 
132
+ model_path = os.path.dirname(os.path.abspath(__file__))
133
+ tokenizer = AutoTokenizer.from_pretrained(model_path)
134
+ model = AutoModelForSequenceClassification.from_pretrained(model_path)
135
 
136
  # Load the local categories
137
  try:
138
+ with open(os.path.join(model_path, "categories.json"), "r") as f:
 
 
139
  categories = json.load(f)
140
  except Exception as e:
141
  print(f"Error loading categories: {str(e)}")