jedick commited on
Commit
0efb496
·
1 Parent(s): 08fac87

Use MODEL_ID variable

Browse files
Files changed (1) hide show
  1. main.py +6 -2
main.py CHANGED
@@ -130,10 +130,14 @@ def GetChatModel(compute_location):
130
  if compute_location == "edge" and not torch.cuda.is_available():
131
  raise Exception("Edge chat model selected without GPU")
132
 
 
 
 
 
 
 
133
  # Define the pipeline to pass to the HuggingFacePipeline class
134
  # https://huggingface.co/blog/langchain
135
- # model_id = "HuggingFaceTB/SmolLM3-3B"
136
- model_id = "google/gemma-3-1b-it"
137
  tokenizer = AutoTokenizer.from_pretrained(model_id)
138
  model = AutoModelForCausalLM.from_pretrained(
139
  model_id,
 
130
  if compute_location == "edge" and not torch.cuda.is_available():
131
  raise Exception("Edge chat model selected without GPU")
132
 
133
+ # Get the model ID (we can define the variable in HF Spaces settings)
134
+ model_id = os.getenv("MODEL_ID")
135
+ if model_id is None:
136
+ # model_id = "HuggingFaceTB/SmolLM3-3B"
137
+ model_id = "google/gemma-3-1b-it"
138
+
139
  # Define the pipeline to pass to the HuggingFacePipeline class
140
  # https://huggingface.co/blog/langchain
 
 
141
  tokenizer = AutoTokenizer.from_pretrained(model_id)
142
  model = AutoModelForCausalLM.from_pretrained(
143
  model_id,