Spaces:
Runtime error
Runtime error
metadata
title: Chatapi
emoji: 🔥
colorFrom: purple
colorTo: purple
sdk: docker
pinned: false
license: apache-2.0
duplicated_from: Subhraj07/chatapi
How to Use the API using python
Create a Token
import requests
headers = {
'accept': 'application/json',
'Content-Type': 'application/json',
}
json_data = {
"ref_key": "F0eeQ419wvoCSPH7KBmsd9OiVkF0W0DxK1XE9T3BlbkFJ0",
"expiry_date": "2023-06-15"
}
response = requests.post('https://subhraj07-chatapi.hf.space/create', headers=headers, json=json_data)
token = response.json()
calling open API (text-davinci-002/gpt-3.5-turbo)
import requests
headers = {
'accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': 'Bearer TOKEN',
}
json_data = {
'data': []
}
response = requests.post('https://subhraj07-chatapi.hf.space/transcribe', headers=headers, json=json_data)
if response.status_code == 200:
print(response.json())
Check list of tokens
import requests
headers = {
'accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': 'Bearer TOKEN
}
response = requests.get('https://subhraj07-chatapi.hf.space/list', headers=headers)
print(response.json())