Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,25 +1,17 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import cv2
|
| 3 |
-
import numpy as np
|
| 4 |
-
from PIL import Image
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
ret, frame = cap.read()
|
| 11 |
-
if not ret:
|
| 12 |
-
break
|
| 13 |
-
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
|
| 14 |
-
yield Image.fromarray(frame)
|
| 15 |
-
cap.release()
|
| 16 |
|
| 17 |
-
# Create Gradio
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
|
| 25 |
-
|
|
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
+
# Define the function to process the webcam input
|
| 4 |
+
def capture_image(image):
|
| 5 |
+
# You can process the image if you want. Here, we just return it.
|
| 6 |
+
return image
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
+
# Create the Gradio interface
|
| 9 |
+
interface = gr.Interface(
|
| 10 |
+
fn=capture_image, # Function to process the image
|
| 11 |
+
inputs=gr.Image(source="webcam"), # Capture webcam image
|
| 12 |
+
outputs=gr.Image(), # Display the captured image
|
| 13 |
+
live=True # Make it responsive
|
| 14 |
+
)
|
| 15 |
|
| 16 |
+
# Launch the interface
|
| 17 |
+
interface.launch()
|