Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import numpy as np
|
| 3 |
+
import cv2
|
| 4 |
+
|
| 5 |
+
def process_webcam_image(image):
|
| 6 |
+
# gray_image = cv2.cvtColor(np.array(image), cv2.COLOR_BGR2GRAY)
|
| 7 |
+
gray_image = image
|
| 8 |
+
return gray_image
|
| 9 |
+
|
| 10 |
+
iface = gr.Interface(
|
| 11 |
+
fn=process_webcam_image,
|
| 12 |
+
inputs=gr.Image(source="webcam", streaming=True),
|
| 13 |
+
live=True,
|
| 14 |
+
outputs="image",
|
| 15 |
+
title="Real-time Webcam Grayscale",
|
| 16 |
+
description="This demo converts your webcam feed to grayscale in real-time."
|
| 17 |
+
)
|
| 18 |
+
|
| 19 |
+
iface.launch()
|