Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,21 +1,17 @@
|
|
| 1 |
import os
|
| 2 |
import gradio as gr
|
| 3 |
import requests
|
| 4 |
-
import json
|
| 5 |
|
| 6 |
-
#
|
| 7 |
-
os.
|
|
|
|
|
|
|
| 8 |
|
| 9 |
-
#
|
| 10 |
-
|
| 11 |
|
| 12 |
-
|
| 13 |
-
raise ValueError("MODEL_REPO_ID token not found. Please set the MODEL_REPO_ID environment variable.")
|
| 14 |
-
|
| 15 |
-
# Hugging Face Inference API Details
|
| 16 |
-
API_URL = "https://api-inference.huggingface.co/models/mistralai/Mistral-7B-Instruct-v0.3" # Corrected URL
|
| 17 |
-
|
| 18 |
-
HEADERS = {"Authorization": f"Bearer {model_repo_id}"}
|
| 19 |
|
| 20 |
def generate_exegesis(passage):
|
| 21 |
if not passage.strip():
|
|
|
|
| 1 |
import os
|
| 2 |
import gradio as gr
|
| 3 |
import requests
|
| 4 |
+
import json
|
| 5 |
|
| 6 |
+
# Retrieve the API token from secrets
|
| 7 |
+
api_token = os.getenv("_API_TOKEN")
|
| 8 |
+
if not api_token:
|
| 9 |
+
raise ValueError("API token not found. Make sure '_API_TOKEN' is set in the Secrets.")
|
| 10 |
|
| 11 |
+
# Use the token in your request headers
|
| 12 |
+
HEADERS = {"Authorization": f"Bearer {api_token}"}
|
| 13 |
|
| 14 |
+
# ... rest of your code ...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
def generate_exegesis(passage):
|
| 17 |
if not passage.strip():
|