Spaces:
Running
Running
Update app/main.py
Browse files- app/main.py +6 -2
app/main.py
CHANGED
@@ -5,6 +5,8 @@ from pydantic import BaseModel
|
|
5 |
import re
|
6 |
import os
|
7 |
|
|
|
|
|
8 |
|
9 |
app = FastAPI()
|
10 |
|
@@ -52,7 +54,7 @@ async def root(item: Item):
|
|
52 |
}
|
53 |
headers = {
|
54 |
"content-type": "application/json",
|
55 |
-
"X-RapidAPI-Key":
|
56 |
"X-RapidAPI-Host": "text-analysis12.p.rapidapi.com"
|
57 |
}
|
58 |
|
@@ -104,8 +106,10 @@ async def root(item: Item):
|
|
104 |
|
105 |
article = extract_article_content(item.url)
|
106 |
|
|
|
|
|
107 |
API_URL = "https://api-inference.huggingface.co/models/facebook/bart-large-cnn"
|
108 |
-
headers = {'Authorization':
|
109 |
|
110 |
|
111 |
def query(payload):
|
|
|
5 |
import re
|
6 |
import os
|
7 |
|
8 |
+
token = os.environ.get("huggingface_token")
|
9 |
+
key = os.environ.get("rapid_key")
|
10 |
|
11 |
app = FastAPI()
|
12 |
|
|
|
54 |
}
|
55 |
headers = {
|
56 |
"content-type": "application/json",
|
57 |
+
"X-RapidAPI-Key": key,
|
58 |
"X-RapidAPI-Host": "text-analysis12.p.rapidapi.com"
|
59 |
}
|
60 |
|
|
|
106 |
|
107 |
article = extract_article_content(item.url)
|
108 |
|
109 |
+
|
110 |
+
|
111 |
API_URL = "https://api-inference.huggingface.co/models/facebook/bart-large-cnn"
|
112 |
+
headers = {'Authorization': token}
|
113 |
|
114 |
|
115 |
def query(payload):
|