forked from cgvr/DeltaVR
update main README
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"execution_count": 4,
|
||||
"id": "77b23cd8",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -22,29 +22,16 @@
|
||||
"# API endpoint\n",
|
||||
"BASE_URL = \"http://127.0.0.1:7960\"\n",
|
||||
"\n",
|
||||
"def generate_no_preview(image_base64: str):\n",
|
||||
"def generate_no_preview(data: dict):\n",
|
||||
" \"\"\"Generate 3D model from a single base64-encoded image without previews.\n",
|
||||
" \n",
|
||||
" Args:\n",
|
||||
" image_base64: Base64 string of the image (without 'data:image/...' prefix)\n",
|
||||
" \"\"\"\n",
|
||||
" try:\n",
|
||||
" # Set generation parameters\n",
|
||||
" params = {\n",
|
||||
" 'image_base64': image_base64,\n",
|
||||
" 'seed': 42,\n",
|
||||
" 'ss_guidance_strength': 7.5,\n",
|
||||
" 'ss_sampling_steps': 30,\n",
|
||||
" 'slat_guidance_strength': 7.5,\n",
|
||||
" 'slat_sampling_steps': 30,\n",
|
||||
" 'mesh_simplify_ratio': 0.95,\n",
|
||||
" 'texture_size': 1024,\n",
|
||||
" 'output_format': 'glb'\n",
|
||||
" }\n",
|
||||
" \n",
|
||||
" # Start generation\n",
|
||||
" print(\"Starting generation...\")\n",
|
||||
" response = requests.post(f\"{BASE_URL}/generate_no_preview\", data=params)\n",
|
||||
" response = requests.post(f\"{BASE_URL}/generate_no_preview\", data)\n",
|
||||
" print(\"Response status:\", response.status_code)\n",
|
||||
" response.raise_for_status()\n",
|
||||
" \n",
|
||||
@@ -75,7 +62,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"execution_count": 11,
|
||||
"id": "eb122295",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -85,7 +72,19 @@
|
||||
" image_data = image_file.read()\n",
|
||||
"\n",
|
||||
" base64_encoded = base64.b64encode(image_data).decode('utf-8')\n",
|
||||
" model = generate_no_preview(base64_encoded)\n",
|
||||
" # Set generation parameters\n",
|
||||
" data = {\n",
|
||||
" 'image_base64': base64_encoded,\n",
|
||||
" 'seed': 42,\n",
|
||||
" 'ss_guidance_strength': 8,\n",
|
||||
" 'ss_sampling_steps': 10,\n",
|
||||
" 'slat_guidance_strength': 6,\n",
|
||||
" 'slat_sampling_steps': 10,\n",
|
||||
" 'mesh_simplify_ratio': 0.9958,\n",
|
||||
" 'texture_size': 1024,\n",
|
||||
" 'output_format': 'glb'\n",
|
||||
" }\n",
|
||||
" model = generate_no_preview(data)\n",
|
||||
" \n",
|
||||
" with open(output_path, 'wb') as f:\n",
|
||||
" f.write(model)\n",
|
||||
@@ -94,7 +93,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"execution_count": 12,
|
||||
"id": "2ce7dfdf",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
@@ -107,14 +106,14 @@
|
||||
"Progress: 100%\n",
|
||||
"Downloading model...\n",
|
||||
"Model downloaded.\n",
|
||||
"Model saved to test_resources/style_test_3_model.glb\n"
|
||||
"Model saved to test_resources/mesh_simplify_ratio_0.998.glb\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"\n",
|
||||
"image_path = 'test_resources/style_test_3.jpg'\n",
|
||||
"output_path = \"test_resources/style_test_3_model.glb\"\n",
|
||||
"image_path = 'test_resources/512x512.png'\n",
|
||||
"output_path = \"test_resources/mesh_simplify_ratio_0.998.glb\"\n",
|
||||
"\n",
|
||||
"generate_model(image_path, output_path)"
|
||||
]
|
||||
@@ -130,7 +129,7 @@
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": ".venv",
|
||||
"display_name": ".venv (3.10.11)",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user