Updated
Browse files
app.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import os
|
| 2 |
import requests
|
| 3 |
import gradio as gr # Or whatever UI you use
|
|
|
|
| 4 |
|
| 5 |
# 1. Pull your secret token
|
| 6 |
HF_TOKEN = os.environ.get("HF_TOKEN")
|
|
@@ -65,9 +66,9 @@ app.add_middleware(
|
|
| 65 |
)
|
| 66 |
'''
|
| 67 |
# Define Method 1: Triggers when client calls /gradio_api/call/update_data
|
| 68 |
-
|
| 69 |
@app.post("/call_private_api")
|
| 70 |
-
def call_private_api(user_input: str) -> dict:
|
| 71 |
|
| 72 |
headers = {
|
| 73 |
"Authorization": f"Bearer {HF_TOKEN}",
|
|
|
|
| 1 |
import os
|
| 2 |
import requests
|
| 3 |
import gradio as gr # Or whatever UI you use
|
| 4 |
+
from fastapi import Body
|
| 5 |
|
| 6 |
# 1. Pull your secret token
|
| 7 |
HF_TOKEN = os.environ.get("HF_TOKEN")
|
|
|
|
| 66 |
)
|
| 67 |
'''
|
| 68 |
# Define Method 1: Triggers when client calls /gradio_api/call/update_data
|
| 69 |
+
@app.api(name="call_private_api")
|
| 70 |
@app.post("/call_private_api")
|
| 71 |
+
def call_private_api(user_input: str = Body(..., embed=True)) -> dict:
|
| 72 |
|
| 73 |
headers = {
|
| 74 |
"Authorization": f"Bearer {HF_TOKEN}",
|