Josebert commited on
Commit
6532640
·
verified ·
1 Parent(s): dda7a68

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -12
app.py CHANGED
@@ -1,21 +1,17 @@
1
  import os
2
  import gradio as gr
3
  import requests
4
- import json # Import the json module
5
 
6
- # Run the Hugging Face CLI login command.
7
- os.system("huggingface-cli login")
 
 
8
 
9
- # Retrieve the API token from environment variables
10
- model_repo_id = os.getenv("MODEL_REPO_ID")
11
 
12
- if not model_repo_id:
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():