Spaces:
Running
Running
Akash Raj
commited on
Commit
·
1d0844e
1
Parent(s):
7e9d2f3
test
Browse files
app.py
CHANGED
|
@@ -1,7 +1,35 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
-
def
|
| 4 |
-
|
|
|
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
+
def duplicate_image(image):
|
| 4 |
+
# Simply return the same image twice
|
| 5 |
+
return image, image
|
| 6 |
|
| 7 |
+
# Create a Gradio interface
|
| 8 |
+
iface = gr.Interface(
|
| 9 |
+
fn=duplicate_image,
|
| 10 |
+
inputs=gr.Image(type="pil"),
|
| 11 |
+
outputs=[gr.Image(type="pil"), gr.Image(type="pil")],
|
| 12 |
+
title="Duplicate Image",
|
| 13 |
+
description="Upload an image and get two identical copies as output."
|
| 14 |
+
)
|
| 15 |
+
|
| 16 |
+
# Launch the Gradio app
|
| 17 |
+
iface.launch()
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
"""
|
| 21 |
+
from transformers import pipeline
|
| 22 |
+
from PIL import Image
|
| 23 |
+
import requests
|
| 24 |
+
|
| 25 |
+
# load pipe
|
| 26 |
+
pipe = pipeline(task="depth-estimation", model="LiheYoung/depth-anything-small-hf")
|
| 27 |
+
|
| 28 |
+
# load image
|
| 29 |
+
url = 'http://images.cocodataset.org/val2017/000000039769.jpg'
|
| 30 |
+
image = Image.open(requests.get(url, stream=True).raw)
|
| 31 |
+
|
| 32 |
+
# inference
|
| 33 |
+
depth = pipe(image)["depth"]
|
| 34 |
+
|
| 35 |
+
"""
|