Septzzz's picture
Upload folder using huggingface_hub (part 23)
a2a9aa6 verified
Raw
History Blame Contribute Delete
2.31 kB
import requests
import json
from datetime import date, datetime, timedelta
import os
from typing import Optional, Dict, Union, List
def thumbnail(url: str, toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
" "
url: A string containing an url of a '.glb' file
"""
url = f"https://3d-services.p.rapidapi.com/thumbnail"
querystring = {'url': url, }
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "3d-services.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation
def version(toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
" "
"""
url = f"https://3d-services.p.rapidapi.com/api/version"
querystring = {}
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "3d-services.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation
def blender_project(mode: str, url: str, toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"(Warnig - in zip mode the return of this api is a large file (~20MB)) similar to executing blender --background ./main.blend --python ./script.py. The zip in parameter should be composed of a main.blend file and a script.py. see example here https://files.aptero.co/api/public/dl/CJTvv0V7?inline=true"
mode: output mode of the query (zip or img)
url: A string containing an url of a '.zip' file of the project
"""
url = f"https://3d-services.p.rapidapi.com/blender/project/{mode}"
querystring = {'url': url, }
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "3d-services.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation