ake178178 commited on
Commit
e675cc8
·
verified ·
1 Parent(s): 36e8a41

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -9
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(video):
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.Video(source="webcam"),
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="摄像头拍照",