Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,18 +1,13 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from PIL import Image
|
| 3 |
-
import numpy as np
|
| 4 |
|
| 5 |
-
#
|
| 6 |
-
def capture_image(
|
| 7 |
-
# 获取视频的第一帧
|
| 8 |
-
frame = video[0]
|
| 9 |
-
image = Image.fromarray(frame)
|
| 10 |
return image
|
| 11 |
|
| 12 |
-
# 使用 Gradio
|
| 13 |
demo = gr.Interface(
|
| 14 |
fn=capture_image,
|
| 15 |
-
inputs=gr.
|
| 16 |
outputs="image",
|
| 17 |
live=True,
|
| 18 |
title="摄像头拍照",
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
| 2 |
|
| 3 |
+
# 定义一个简单的拍照函数
|
| 4 |
+
def capture_image(image):
|
|
|
|
|
|
|
|
|
|
| 5 |
return image
|
| 6 |
|
| 7 |
+
# 使用 Gradio 创建一个摄像头界面
|
| 8 |
demo = gr.Interface(
|
| 9 |
fn=capture_image,
|
| 10 |
+
inputs=gr.Image(source="webcam", tool="editor"),
|
| 11 |
outputs="image",
|
| 12 |
live=True,
|
| 13 |
title="摄像头拍照",
|