Updated api route
Browse files
app.py
CHANGED
|
@@ -9,6 +9,7 @@ HF_TOKEN = os.environ.get("HF_TOKEN")
|
|
| 9 |
# Note: Use the direct .hf.space URL
|
| 10 |
API_URL = "https://rr19tech-plnb-demo.hf.space/"
|
| 11 |
|
|
|
|
| 12 |
def call_private_api(payload):
|
| 13 |
# Pass the token in the Authorization header
|
| 14 |
headers = {
|
|
@@ -19,7 +20,7 @@ def call_private_api(payload):
|
|
| 19 |
response = requests.post(API_URL, json={"input": payload}, headers=headers)
|
| 20 |
|
| 21 |
if response.status_code == 200:
|
| 22 |
-
return response.json()
|
| 23 |
else:
|
| 24 |
return f"Error: {response.status_code} - {response.text}"
|
| 25 |
|
|
|
|
| 9 |
# Note: Use the direct .hf.space URL
|
| 10 |
API_URL = "https://rr19tech-plnb-demo.hf.space/"
|
| 11 |
|
| 12 |
+
@app.route("/get_content", methods=["GET"])
|
| 13 |
def call_private_api(payload):
|
| 14 |
# Pass the token in the Authorization header
|
| 15 |
headers = {
|
|
|
|
| 20 |
response = requests.post(API_URL, json={"input": payload}, headers=headers)
|
| 21 |
|
| 22 |
if response.status_code == 200:
|
| 23 |
+
return response.json(), response.status_code
|
| 24 |
else:
|
| 25 |
return f"Error: {response.status_code} - {response.text}"
|
| 26 |
|