burtenshaw commited on
Commit
13f2c6f
·
1 Parent(s): 0996ebd

add params for endpoint config

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -19,6 +19,12 @@ EXAM_MAX_QUESTIONS = int(
19
  EXAM_PASSING_SCORE = float(os.getenv("EXAM_PASSING_SCORE", 0.8))
20
  EXAM_DATASET_ID = "agents-course/smolagents-quiz-data"
21
 
 
 
 
 
 
 
22
  # prep the dataset for the quiz
23
  ds = load_dataset(EXAM_DATASET_ID, split="train", download_mode="force_redownload")
24
  quiz_data = list(ds) # Convert dataset to list instead of using to_list()
@@ -82,9 +88,10 @@ def check_code(
82
 
83
  try:
84
  completion = client.chat.completions.create(
85
- model="https://sm6g3bin692qbz80.us-east-1.aws.endpoints.huggingface.cloud",
86
  messages=messages,
87
  max_tokens=500,
 
88
  )
89
 
90
  response = completion.choices[0].message.content.strip()
 
19
  EXAM_PASSING_SCORE = float(os.getenv("EXAM_PASSING_SCORE", 0.8))
20
  EXAM_DATASET_ID = "agents-course/smolagents-quiz-data"
21
 
22
+ # inference client config
23
+ HF_TOKEN = os.getenv("HF_TOKEN")
24
+ HF_API_URL = os.getenv(
25
+ "HF_API_URL", "https://sm6g3bin692qbz80.us-east-1.aws.endpoints.huggingface.cloud"
26
+ )
27
+
28
  # prep the dataset for the quiz
29
  ds = load_dataset(EXAM_DATASET_ID, split="train", download_mode="force_redownload")
30
  quiz_data = list(ds) # Convert dataset to list instead of using to_list()
 
88
 
89
  try:
90
  completion = client.chat.completions.create(
91
+ model=HF_API_URL,
92
  messages=messages,
93
  max_tokens=500,
94
+ token=HF_TOKEN,
95
  )
96
 
97
  response = completion.choices[0].message.content.strip()