Spaces:
Runtime error
Runtime error
Commit
·
540a9b3
1
Parent(s):
34bb298
update
Browse files
app.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
import spaces
|
| 3 |
|
| 4 |
import os
|
|
@@ -36,10 +37,9 @@ def end_session(req: gr.Request):
|
|
| 36 |
shutil.rmtree(user_dir)
|
| 37 |
|
| 38 |
|
| 39 |
-
@spaces.GPU()
|
| 40 |
def remove_background(input: Image.Image) -> Image.Image:
|
| 41 |
input = input.convert('RGB')
|
| 42 |
-
output =
|
| 43 |
return output
|
| 44 |
|
| 45 |
|
|
@@ -357,7 +357,9 @@ with gr.Blocks(delete_cache=(600, 600)) as demo:
|
|
| 357 |
|
| 358 |
# Launch the Gradio app
|
| 359 |
if __name__ == "__main__":
|
|
|
|
| 360 |
pipeline = Trellis2ImageTo3DPipeline.from_pretrained('microsoft/TRELLIS.2-4B')
|
|
|
|
| 361 |
pipeline.low_vram = False
|
| 362 |
pipeline.cuda()
|
| 363 |
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from gradio_client import Client
|
| 3 |
import spaces
|
| 4 |
|
| 5 |
import os
|
|
|
|
| 37 |
shutil.rmtree(user_dir)
|
| 38 |
|
| 39 |
|
|
|
|
| 40 |
def remove_background(input: Image.Image) -> Image.Image:
|
| 41 |
input = input.convert('RGB')
|
| 42 |
+
output = rmbg_client.predict(input, api_name="/image")[0][0]
|
| 43 |
return output
|
| 44 |
|
| 45 |
|
|
|
|
| 357 |
|
| 358 |
# Launch the Gradio app
|
| 359 |
if __name__ == "__main__":
|
| 360 |
+
rmbg_client = Client("briaai/BRIA-RMBG-2.0")
|
| 361 |
pipeline = Trellis2ImageTo3DPipeline.from_pretrained('microsoft/TRELLIS.2-4B')
|
| 362 |
+
pipeline.rembg_model = None
|
| 363 |
pipeline.low_vram = False
|
| 364 |
pipeline.cuda()
|
| 365 |
|