Update index.html
Browse files- index.html +14 -3
index.html
CHANGED
|
@@ -25,13 +25,23 @@ import gradio as gr
|
|
| 25 |
|
| 26 |
transformers = await import_transformers_js()
|
| 27 |
pipeline = transformers.pipeline
|
| 28 |
-
depth_estimator = await pipeline('depth-estimation', 'Xenova/depth-anything-
|
| 29 |
|
| 30 |
|
| 31 |
async def estimate(input_image):
|
| 32 |
output = await depth_estimator(as_url(input_image))
|
| 33 |
-
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
demo = gr.Interface(
|
| 37 |
fn=estimate,
|
|
@@ -39,6 +49,7 @@ demo = gr.Interface(
|
|
| 39 |
gr.Image(type="filepath")
|
| 40 |
],
|
| 41 |
outputs=[
|
|
|
|
| 42 |
gr.JSON(),
|
| 43 |
],
|
| 44 |
examples=[
|
|
|
|
| 25 |
|
| 26 |
transformers = await import_transformers_js()
|
| 27 |
pipeline = transformers.pipeline
|
| 28 |
+
depth_estimator = await pipeline('depth-estimation', 'Xenova/depth-anything-small-hf');
|
| 29 |
|
| 30 |
|
| 31 |
async def estimate(input_image):
|
| 32 |
output = await depth_estimator(as_url(input_image))
|
| 33 |
+
|
| 34 |
+
depth_image = output["depth"].to_pil()
|
| 35 |
+
|
| 36 |
+
tensor = output["predicted_depth"]
|
| 37 |
+
tensor_data = {
|
| 38 |
+
"dims": tensor.dims,
|
| 39 |
+
"type": tensor.type,
|
| 40 |
+
"data": tensor.data,
|
| 41 |
+
"size": tensor.size,
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
return depth_image, tensor_data
|
| 45 |
|
| 46 |
demo = gr.Interface(
|
| 47 |
fn=estimate,
|
|
|
|
| 49 |
gr.Image(type="filepath")
|
| 50 |
],
|
| 51 |
outputs=[
|
| 52 |
+
gr.Image(),
|
| 53 |
gr.JSON(),
|
| 54 |
],
|
| 55 |
examples=[
|