#Introduction
Here's a quick start script for you to get started with the generations
Python
import requests
import json
from tqdm import tqdm
import glob
import os
import time
from pathlib import Path
import time
url = "https://api.csm.ai:5566/image-to-3d-sessions"
API_SECRET_KEY = "<ENTER_YOUR_SECRET_KEY>"
################### Create image session ##################
headers = {
'x-api-key': API_SECRET_KEY,
'Content-Type': 'application/json'
}
payload = json.dumps({
"image_url": "https://via.placeholder.com/300/09f/fff.png",
"preview_mesh": "turbo",
"pixel_alignment": "highest",
"model_resolution": "high",
"resolution": "high_poly",
"diffusion_time_steps": 75,
"auto_gen_3d": True,
"topology": "quads",
"texture_resolution": 2048
})
response = requests.post(url, headers=headers, data=payload)
ret = json.loads(response.text)
print(response.text)
time.sleep(60)
################### Check spin details session ##################
url = "https://api.csm.ai:5566/image-to-3d-sessions/SESSION_1709062708_6579176"
payload = {}
headers = {
'x-api-key': API_SECRET_KEY,
'Content-Type': 'application/json'
}
response = requests.request("GET", url, headers=headers, data=payload)
jsond = json.loads(response.text)
################### Select spin ##################
chosen_spin_id = 0
url = "https://api.csm.ai:5566/image-to-3d-sessions/get-3d/preview/SESSION_1709062708_6579176"
payload = json.dumps({
"selected_spin_index": 0,
"selected_spin": jsond['data']['spins'][chosen_spin_id]['image_url']
})
headers = {
'x-api-key': API_SECRET_KEY,
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)