Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,8 @@
|
|
1 |
import os
|
2 |
-
from transformers import pipeline
|
3 |
import gradio as gr
|
|
|
|
|
4 |
import logging
|
5 |
-
from dotenv import load_dotenv
|
6 |
-
|
7 |
-
load_dotenv() # Load environment variables from .env file
|
8 |
|
9 |
# Retrieve the API token from secrets
|
10 |
api_token = os.getenv("API_TOKEN")
|
@@ -15,8 +13,9 @@ if not api_token:
|
|
15 |
logging.basicConfig(level=logging.INFO)
|
16 |
logger = logging.getLogger(__name__)
|
17 |
|
18 |
-
#
|
19 |
-
|
|
|
20 |
|
21 |
def generate_exegesis(passage):
|
22 |
if not passage.strip():
|
|
|
1 |
import os
|
|
|
2 |
import gradio as gr
|
3 |
+
import requests
|
4 |
+
import json
|
5 |
import logging
|
|
|
|
|
|
|
6 |
|
7 |
# Retrieve the API token from secrets
|
8 |
api_token = os.getenv("API_TOKEN")
|
|
|
13 |
logging.basicConfig(level=logging.INFO)
|
14 |
logger = logging.getLogger(__name__)
|
15 |
|
16 |
+
# Use the token in your request headers
|
17 |
+
API_URL = "https://api-inference.huggingface.co/models/mistralai/Mistral-7B-Instruct-v0.3"
|
18 |
+
HEADERS = {"Authorization": f"Bearer {api_token}"}
|
19 |
|
20 |
def generate_exegesis(passage):
|
21 |
if not passage.strip():
|