Spaces:
Build error
Build error
Deploy custom model via Nexus AI Studio
Browse files- README.md +11 -6
- app.py +27 -0
- requirements.txt +2 -0
README.md
CHANGED
|
@@ -1,12 +1,17 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version:
|
|
|
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
---
|
| 11 |
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: text-to-3dmodel
|
| 3 |
+
emoji: 🚀
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: indigo
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 4.44.1
|
| 8 |
+
python_version: 3.10
|
| 9 |
app_file: app.py
|
| 10 |
pinned: false
|
| 11 |
---
|
| 12 |
|
| 13 |
+
# text-to-3dmodel
|
| 14 |
+
|
| 15 |
+
This is a custom AI model deployed via Nexus AI Studio.
|
| 16 |
+
Base Model: [stabilityai/stable-zero123](https://huggingface.co/stabilityai/stable-zero123)
|
| 17 |
+
Task: text-to-3d
|
app.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from huggingface_hub import InferenceClient
|
| 3 |
+
|
| 4 |
+
model_id = "stabilityai/stable-zero123"
|
| 5 |
+
client = InferenceClient(model_id)
|
| 6 |
+
|
| 7 |
+
def generate_3d(prompt):
|
| 8 |
+
try:
|
| 9 |
+
response = client.post(json={"inputs": prompt})
|
| 10 |
+
filename = "output.glb"
|
| 11 |
+
with open(filename, "wb") as f:
|
| 12 |
+
f.write(response)
|
| 13 |
+
return filename
|
| 14 |
+
except Exception as e:
|
| 15 |
+
raise gr.Error(str(e))
|
| 16 |
+
|
| 17 |
+
demo = gr.Interface(
|
| 18 |
+
fn=generate_3d,
|
| 19 |
+
inputs=gr.Textbox(label="Prompt", placeholder="Describe the 3D model you want..."),
|
| 20 |
+
outputs=gr.Model3D(label="3D Model"),
|
| 21 |
+
title="text-to-3dmodel",
|
| 22 |
+
description="Text to 3D generation powered by " + model_id,
|
| 23 |
+
theme="soft"
|
| 24 |
+
)
|
| 25 |
+
|
| 26 |
+
if __name__ == "__main__":
|
| 27 |
+
demo.launch()
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio
|
| 2 |
+
huggingface_hub
|