hideosnes commited on
Commit
4ad3e81
1 Parent(s): 8c621cb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -54
app.py CHANGED
@@ -20,41 +20,9 @@ from tsr.utils import remove_background, resize_foreground, to_gradio_3d_orienta
20
 
21
 
22
  HEADER = """
23
- # TripoSR Demo
24
- <table bgcolor="#1E2432" cellspacing="0" cellpadding="0" width="450">
25
- <tr style="height:50px;">
26
- <td style="text-align: center;">
27
- <a href="https://stability.ai">
28
- <img src="https://images.squarespace-cdn.com/content/v1/6213c340453c3f502425776e/6c9c4c25-5410-4547-bc26-dc621cdacb25/Stability+AI+logo.png" width="200" height="40" />
29
- </a>
30
- </td>
31
- <td style="text-align: center;">
32
- <a href="https://www.tripo3d.ai">
33
- <img src="https://tripo-public.cdn.bcebos.com/logo.png" width="40" height="40" />
34
- </a>
35
- </td>
36
- </tr>
37
- </table>
38
- <table bgcolor="#1E2432" cellspacing="0" cellpadding="0" width="450">
39
- <tr style="height:30px;">
40
- <td style="text-align: center;">
41
- <a href="https://huggingface.co/stabilityai/TripoSR"><img src="https://img.shields.io/badge/%F0%9F%A4%97%20Model_Card-Huggingface-orange" height="20"></a>
42
- </td>
43
- <td style="text-align: center;">
44
- <a href="https://github.com/VAST-AI-Research/TripoSR"><img src="https://postimage.me/images/2024/03/04/GitHub_Logo_White.png" width="100" height="20"></a>
45
- </td>
46
- <td style="text-align: center; color: white;">
47
- <a href="https://arxiv.org/abs/2403.02151"><img src="https://img.shields.io/badge/arXiv-2403.02151-b31b1b.svg" height="20"></a>
48
- </td>
49
- </tr>
50
- </table>
51
-
52
- **TripoSR** is a state-of-the-art open-source model for **fast** feedforward 3D reconstruction from a single image, developed in collaboration between [Tripo AI](https://www.tripo3d.ai/) and [Stability AI](https://stability.ai/).
53
-
54
- **Tips:**
55
- 1. If you find the result is unsatisfied, please try to change the foreground ratio. It might improve the results.
56
- 2. It's better to disable "Remove Background" for the provided examples since they have been already preprocessed.
57
- 3. Otherwise, please disable "Remove Background" option only if your input image is RGBA with transparent background, image contents are centered and occupy more than 70% of image width or height.
58
  """
59
 
60
 
@@ -130,53 +98,53 @@ with gr.Blocks() as demo:
130
  type="pil",
131
  elem_id="content_image",
132
  )
133
- processed_image = gr.Image(label="Processed Image", interactive=False)
134
  with gr.Row():
135
  with gr.Group():
136
  do_remove_background = gr.Checkbox(
137
- label="Remove Background", value=True
138
  )
139
  foreground_ratio = gr.Slider(
140
- label="Foreground Ratio",
141
  minimum=0.5,
142
  maximum=1.0,
143
  value=0.85,
144
  step=0.05,
145
  )
146
  mc_resolution = gr.Slider(
147
- label="Marching Cubes Resolution",
148
  minimum=32,
149
  maximum=320,
150
  value=256,
151
  step=32
152
  )
153
  with gr.Row():
154
- submit = gr.Button("Generate", elem_id="generate", variant="primary")
155
  with gr.Column():
156
  with gr.Tab("OBJ"):
157
  output_model_obj = gr.Model3D(
158
  label="Output Model (OBJ Format)",
159
  interactive=False,
160
  )
161
- gr.Markdown("Note: Downloaded object will be flipped in case of .obj export. Export .glb instead or manually flip it before usage.")
162
  with gr.Tab("GLB"):
163
  output_model_glb = gr.Model3D(
164
  label="Output Model (GLB Format)",
165
  interactive=False,
166
  )
167
- gr.Markdown("Note: The model shown here has a darker appearance. Download to get correct results.")
168
- with gr.Row(variant="panel"):
169
- gr.Examples(
170
- examples=[
171
- os.path.join("examples", img_name) for img_name in sorted(os.listdir("examples"))
172
- ],
173
- inputs=[input_image],
174
- outputs=[processed_image, output_model_obj, output_model_glb],
175
- cache_examples=True,
176
- fn=partial(run_example),
177
- label="Examples",
178
- examples_per_page=20
179
- )
180
  submit.click(fn=check_input_image, inputs=[input_image]).success(
181
  fn=preprocess,
182
  inputs=[input_image, do_remove_background, foreground_ratio],
 
20
 
21
 
22
  HEADER = """
23
+ ** ARM <3 GoldExtra ** - 3D extrapolation from 2.5D images
24
+
25
+ --> 2.5D Bild hochladen und BG-Preprocessing aktivieren!
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  """
27
 
28
 
 
98
  type="pil",
99
  elem_id="content_image",
100
  )
101
+ processed_image = gr.Image(label="Preprocess uWu", interactive=False)
102
  with gr.Row():
103
  with gr.Group():
104
  do_remove_background = gr.Checkbox(
105
+ label="Hintergrund entfernen", value=True
106
  )
107
  foreground_ratio = gr.Slider(
108
+ label="Vordergrund definieren",
109
  minimum=0.5,
110
  maximum=1.0,
111
  value=0.85,
112
  step=0.05,
113
  )
114
  mc_resolution = gr.Slider(
115
+ label="MC-Qualität (optional)",
116
  minimum=32,
117
  maximum=320,
118
  value=256,
119
  step=32
120
  )
121
  with gr.Row():
122
+ submit = gr.Button("Simsalabim", elem_id="generate", variant="primary")
123
  with gr.Column():
124
  with gr.Tab("OBJ"):
125
  output_model_obj = gr.Model3D(
126
  label="Output Model (OBJ Format)",
127
  interactive=False,
128
  )
129
+ gr.Markdown(".obj muss gedreht werden! .glb sollte passen. Test this!")
130
  with gr.Tab("GLB"):
131
  output_model_glb = gr.Model3D(
132
  label="Output Model (GLB Format)",
133
  interactive=False,
134
  )
135
+ gr.Markdown("GLB erwartet bereits das lighting vom ARM.")
136
+ # with gr.Row(variant="panel"):
137
+ # gr.Examples(
138
+ # examples=[
139
+ # os.path.join("examples", img_name) for img_name in sorted(os.listdir("examples"))
140
+ # ],
141
+ # inputs=[input_image],
142
+ # outputs=[processed_image, output_model_obj, output_model_glb],
143
+ # cache_examples=True,
144
+ # fn=partial(run_example),
145
+ # label="Examples",
146
+ # examples_per_page=20
147
+ # )
148
  submit.click(fn=check_input_image, inputs=[input_image]).success(
149
  fn=preprocess,
150
  inputs=[input_image, do_remove_background, foreground_ratio],