sayyedAhmed commited on
Commit
d19b2cc
1 Parent(s): ca8e556

sample script to use model using api

Browse files
Files changed (1) hide show
  1. query_api/query_model.py +14 -0
query_api/query_model.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+
3
+ # Replace with your API URL and token
4
+ api_url = "https://api-inference.huggingface.co/models/sayyedAhmed/Crisis_Severity_Predictor_LSTM"
5
+ headers = {"Authorization": f"Bearer YOUR_HUGGINGFACE_TOKEN"}
6
+
7
+ # Define the input data
8
+ data = {"inputs": "Example input text for severity prediction"}
9
+
10
+ # Make the API call
11
+ response = requests.post(api_url, headers=headers, json=data)
12
+
13
+ # Output the response
14
+ print(response.json())