Spaces:
Sleeping
Sleeping
Commit ·
f7fc68e
1
Parent(s): 99c5bcb
fix filename
Browse files
app.py
CHANGED
|
@@ -44,7 +44,12 @@ except: print("Ağırlıklar bulunamadı.")
|
|
| 44 |
|
| 45 |
def predict(file, category_name):
|
| 46 |
if not file: return None
|
| 47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
p = np.array(mesh.vertices)
|
| 49 |
p = p[np.random.choice(len(p), 1024, replace=len(p)<1024)]
|
| 50 |
pos = torch.tensor(p, dtype=torch.float32)
|
|
@@ -65,7 +70,8 @@ def predict(file, category_name):
|
|
| 65 |
fig.update_layout(margin=dict(l=0,r=0,b=0,t=0), scene=dict(xaxis=dict(visible=False), yaxis=dict(visible=False), zaxis=dict(visible=False)))
|
| 66 |
return fig
|
| 67 |
|
| 68 |
-
|
|
|
|
| 69 |
gr.Markdown("# 🚀 Clifford-Dirac 3D Segmentation (0.15M Params)")
|
| 70 |
with gr.Row():
|
| 71 |
with gr.Column():
|
|
@@ -74,4 +80,5 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 74 |
btn = gr.Button("Tahmin Et", variant="primary")
|
| 75 |
out = gr.Plot(label="Sonuç")
|
| 76 |
btn.click(predict, [inp, cat], out)
|
|
|
|
| 77 |
demo.launch()
|
|
|
|
| 44 |
|
| 45 |
def predict(file, category_name):
|
| 46 |
if not file: return None
|
| 47 |
+
|
| 48 |
+
# DÜZELTME: Gradio 6.0'da gr.Model3D doğrudan string (dosya yolu) döndürür.
|
| 49 |
+
# Güvenceye almak için tip kontrolü yapıyoruz.
|
| 50 |
+
file_path = file if isinstance(file, str) else file.name
|
| 51 |
+
|
| 52 |
+
mesh = trimesh.load(file_path, force='mesh')
|
| 53 |
p = np.array(mesh.vertices)
|
| 54 |
p = p[np.random.choice(len(p), 1024, replace=len(p)<1024)]
|
| 55 |
pos = torch.tensor(p, dtype=torch.float32)
|
|
|
|
| 70 |
fig.update_layout(margin=dict(l=0,r=0,b=0,t=0), scene=dict(xaxis=dict(visible=False), yaxis=dict(visible=False), zaxis=dict(visible=False)))
|
| 71 |
return fig
|
| 72 |
|
| 73 |
+
# DÜZELTME: Tema (theme) uyarısını kaldırmak için sade blok tanımı yapıldı.
|
| 74 |
+
with gr.Blocks() as demo:
|
| 75 |
gr.Markdown("# 🚀 Clifford-Dirac 3D Segmentation (0.15M Params)")
|
| 76 |
with gr.Row():
|
| 77 |
with gr.Column():
|
|
|
|
| 80 |
btn = gr.Button("Tahmin Et", variant="primary")
|
| 81 |
out = gr.Plot(label="Sonuç")
|
| 82 |
btn.click(predict, [inp, cat], out)
|
| 83 |
+
|
| 84 |
demo.launch()
|