Spaces:
Sleeping
Sleeping
Update function.py
Browse files- function.py +5 -0
function.py
CHANGED
|
@@ -14,6 +14,10 @@ huggingfacehub_api_token = os.getenv("HUGGINGFACEHUB_API_TOKEN")
|
|
| 14 |
config = {'max_new_tokens': 512, 'temperature': 0.6}
|
| 15 |
|
| 16 |
def GetLLMResponse(selected_topic_level, selected_topic, num_quizzes):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
# Initialize Hugging Face Hub with API token
|
| 18 |
llm = HuggingFaceHub(
|
| 19 |
repo_id="mistralai/Mixtral-8x7B-Instruct-v0.1",
|
|
@@ -49,4 +53,5 @@ def GetLLMResponse(selected_topic_level, selected_topic, num_quizzes):
|
|
| 49 |
|
| 50 |
# Return the response
|
| 51 |
return response
|
|
|
|
| 52 |
|
|
|
|
| 14 |
config = {'max_new_tokens': 512, 'temperature': 0.6}
|
| 15 |
|
| 16 |
def GetLLMResponse(selected_topic_level, selected_topic, num_quizzes):
|
| 17 |
+
# Ensure that the Hugging Face Hub API token is available
|
| 18 |
+
if huggingfacehub_api_token is None:
|
| 19 |
+
raise ValueError("HUGGINGFACEHUB_API_TOKEN environment variable is not set. Set the API token and try again.")
|
| 20 |
+
|
| 21 |
# Initialize Hugging Face Hub with API token
|
| 22 |
llm = HuggingFaceHub(
|
| 23 |
repo_id="mistralai/Mixtral-8x7B-Instruct-v0.1",
|
|
|
|
| 53 |
|
| 54 |
# Return the response
|
| 55 |
return response
|
| 56 |
+
|
| 57 |
|