fal/endpoints/fal_ai/triposr/
mod.rs

1#[allow(unused_imports)]
2use crate::prelude::*;
3#[allow(unused_imports)]
4use serde::{Deserialize, Serialize};
5#[allow(unused_imports)]
6use std::collections::HashMap;
7
8#[cfg(any(
9    feature = "endpoints",
10    feature = "endpoints_fal-ai",
11    feature = "endpoints_fal-ai_triposr"
12))]
13#[cfg_attr(
14    docsrs,
15    doc(cfg(any(
16        feature = "endpoints",
17        feature = "endpoints_fal-ai",
18        feature = "endpoints_fal-ai_triposr"
19    )))
20)]
21pub mod remeshing;
22
23#[derive(Debug, Serialize, Deserialize, Default)]
24pub struct File {
25    /// The mime type of the file.
26    /// "image/png"
27    #[serde(skip_serializing_if = "Option::is_none")]
28    pub content_type: Option<String>,
29    /// File data
30    #[serde(skip_serializing_if = "Option::is_none")]
31    pub file_data: Option<String>,
32    /// The name of the file. It will be auto-generated if not provided.
33    /// "z9RV14K95DvU.png"
34    #[serde(skip_serializing_if = "Option::is_none")]
35    pub file_name: Option<String>,
36    /// The size of the file in bytes.
37    /// 4404019
38    #[serde(skip_serializing_if = "Option::is_none")]
39    pub file_size: Option<i64>,
40    /// The URL where the file can be downloaded from.
41    pub url: String,
42}
43
44#[derive(Debug, Serialize, Deserialize, Default)]
45pub struct HTTPValidationError {
46    #[serde(skip_serializing_if = "Option::is_none")]
47    pub detail: Option<Vec<Option<ValidationError>>>,
48}
49
50#[derive(Debug, Serialize, Deserialize)]
51pub struct ObjectOutput {
52    /// Generated 3D object file.
53    pub model_mesh: File,
54    /// Directory containing textures for the remeshed model.
55    #[serde(skip_serializing_if = "Option::is_none")]
56    pub remeshing_dir: Option<Option<File>>,
57    /// Inference timings.
58    pub timings: Timings,
59}
60
61#[derive(Debug, Serialize, Deserialize, Default)]
62pub struct RemeshingInput {
63    /// Number of faces for remesh
64    #[serde(skip_serializing_if = "Option::is_none")]
65    pub faces: Option<i64>,
66    /// Merge duplicate vertices before exporting
67    #[serde(skip_serializing_if = "Option::is_none")]
68    pub merge: Option<bool>,
69    /// Path for the object file to be remeshed.
70    /// "https://huggingface.co/fal-ai/resources/resolve/main/inputs/example_obj.glb"
71    pub object_url: String,
72    /// Output format for the 3D model.
73    #[serde(skip_serializing_if = "Option::is_none")]
74    pub output_format: Option<String>,
75    /// Preserve UVs during remeshing
76    #[serde(skip_serializing_if = "Option::is_none")]
77    pub preserve_uvs: Option<bool>,
78}
79
80#[derive(Debug, Serialize, Deserialize, Default)]
81pub struct TripoSRInput {
82    /// Whether to remove the background from the input image.
83    #[serde(skip_serializing_if = "Option::is_none")]
84    pub do_remove_background: Option<bool>,
85    /// Ratio of the foreground image to the original image.
86    #[serde(skip_serializing_if = "Option::is_none")]
87    pub foreground_ratio: Option<f64>,
88    /// Path for the image file to be processed.
89    /// "https://raw.githubusercontent.com/VAST-AI-Research/TripoSR/ea034e12a428fa848684a3f9f267b2042d298ca6/examples/hamburger.png"
90    /// "https://raw.githubusercontent.com/VAST-AI-Research/TripoSR/ea034e12a428fa848684a3f9f267b2042d298ca6/examples/poly_fox.png"
91    /// "https://raw.githubusercontent.com/VAST-AI-Research/TripoSR/ea034e12a428fa848684a3f9f267b2042d298ca6/examples/robot.png"
92    /// "https://raw.githubusercontent.com/VAST-AI-Research/TripoSR/ea034e12a428fa848684a3f9f267b2042d298ca6/examples/teapot.png"
93    /// "https://raw.githubusercontent.com/VAST-AI-Research/TripoSR/ea034e12a428fa848684a3f9f267b2042d298ca6/examples/tiger_girl.png"
94    /// "https://raw.githubusercontent.com/VAST-AI-Research/TripoSR/ea034e12a428fa848684a3f9f267b2042d298ca6/examples/horse.png"
95    /// "https://raw.githubusercontent.com/VAST-AI-Research/TripoSR/ea034e12a428fa848684a3f9f267b2042d298ca6/examples/flamingo.png"
96    /// "https://raw.githubusercontent.com/VAST-AI-Research/TripoSR/ea034e12a428fa848684a3f9f267b2042d298ca6/examples/unicorn.png"
97    /// "https://raw.githubusercontent.com/VAST-AI-Research/TripoSR/ea034e12a428fa848684a3f9f267b2042d298ca6/examples/chair.png"
98    /// "https://raw.githubusercontent.com/VAST-AI-Research/TripoSR/ea034e12a428fa848684a3f9f267b2042d298ca6/examples/iso_house.png"
99    /// "https://raw.githubusercontent.com/VAST-AI-Research/TripoSR/ea034e12a428fa848684a3f9f267b2042d298ca6/examples/marble.png"
100    /// "https://raw.githubusercontent.com/VAST-AI-Research/TripoSR/ea034e12a428fa848684a3f9f267b2042d298ca6/examples/police_woman.png"
101    /// "https://raw.githubusercontent.com/VAST-AI-Research/TripoSR/ea034e12a428fa848684a3f9f267b2042d298ca6/examples/captured_p.png"
102    pub image_url: String,
103    /// Resolution of the marching cubes. Above 512 is not recommended.
104    #[serde(skip_serializing_if = "Option::is_none")]
105    pub mc_resolution: Option<i64>,
106    /// Output format for the 3D model.
107    #[serde(skip_serializing_if = "Option::is_none")]
108    pub output_format: Option<String>,
109}
110
111#[derive(Debug, Serialize, Deserialize, Default)]
112pub struct ValidationError {
113    pub loc: Vec<serde_json::Value>,
114    pub msg: String,
115    #[serde(rename = "type")]
116    pub ty: String,
117}
118
119#[derive(Debug, Serialize, Deserialize, Default)]
120pub struct Timings {
121    #[serde(skip_serializing_if = "Option::is_none")]
122    #[serde(rename = "type")]
123    pub ty: Option<serde_json::Value>,
124}
125
126/// TripoSR
127///
128/// Category: image-to-3d
129/// Machine Type: A6000
130pub fn triposr(params: TripoSRInput) -> FalRequest<TripoSRInput, ObjectOutput> {
131    FalRequest::new("fal-ai/triposr", params)
132}