siddartha1506 commited on
Commit
cac9916
·
verified ·
1 Parent(s): 648eb20

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py CHANGED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import requests
3
+
4
+ API_URL = "https://api-inference.huggingface.co/models/TripoSR/TripoSR"
5
+ headers = {"Authorization": "Bearer YOUR_HF_API_KEY"} # replace YOUR_HF_API_KEY
6
+
7
+ def generate_3d(image):
8
+ response = requests.post(API_URL, headers=headers, files={"file": image})
9
+ if response.status_code == 200:
10
+ return response.content
11
+ else:
12
+ return "Error: " + response.text
13
+
14
+ iface = gr.Interface(
15
+ fn=generate_3d,
16
+ inputs=gr.Image(type="filepath", label="Upload 2D Image"),
17
+ outputs="model3d",
18
+ title="Scan Spectrum - 2D to 3D Converter",
19
+ description="Upload any 2D image to get a realistic 3D model you can rotate."
20
+ )
21
+
22
+ iface.launch()