bvhoang42 commited on
Commit
d7772e5
·
verified ·
1 Parent(s): ba303f5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -15
app.py CHANGED
@@ -1,15 +1,7 @@
1
- from huggingface_hub import WebhooksServer, WebhookPayload
2
-
3
- # Define your webhook handler function
4
- def on_webhook_received(payload: WebhookPayload):
5
- # Process the payload as needed
6
- print(f"Received payload: {payload}")
7
-
8
- # Create the webhooks server
9
- webhooks_server = WebhooksServer(webhook_secret="your_secret_key")
10
-
11
- # Add your webhook handler to the server
12
- webhooks_server.add_webhook("/webhook-endpoint")
13
-
14
- # Run the server
15
- webhooks_server.run()
 
1
+ import requests
2
+ API_URL = "https://api-inference.huggingface.co/models/gpt2"
3
+ headers = {"Authorization": f"Bearer {API_TOKEN}"}
4
+ def query(payload):
5
+ response = requests.post(API_URL, headers=headers, json=payload)
6
+ return response.json()
7
+ data = query("Can you please let us know more details about your ")