jboth commited on
Commit
901cd2d
·
verified ·
1 Parent(s): 0f6970b

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +33 -0
app.py CHANGED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os, sys
2
+ os.environ["LIDRA_SKIP_INIT"] = "true"
3
+
4
+ import spaces
5
+ import gradio as gr
6
+
7
+ # Kaolin stub
8
+ from pathlib import Path
9
+ STUB = Path("/home/user/app/kaolin_stub")
10
+ if STUB.exists():
11
+ sys.path.insert(0, str(STUB))
12
+ print("Kaolin stub added")
13
+
14
+ @spaces.GPU(duration=60)
15
+ def diagnose():
16
+ import torch
17
+ lines = [f"torch={torch.__version__}", f"cuda={torch.cuda.is_available()}"]
18
+ if torch.cuda.is_available():
19
+ lines.append(f"gpu={torch.cuda.get_device_name()}")
20
+ try:
21
+ from kaolin.render.camera import Camera
22
+ lines.append("kaolin stub: OK")
23
+ except Exception as e:
24
+ lines.append(f"kaolin: {e}")
25
+ return "\n".join(lines)
26
+
27
+ with gr.Blocks() as demo:
28
+ gr.Markdown("# SAM3D Diagnostic")
29
+ btn = gr.Button("GPU Diagnose")
30
+ out = gr.Textbox(lines=10)
31
+ btn.click(diagnose, outputs=[out])
32
+
33
+ demo.launch()