Remove deprecated 'shape' parameter from tutorial (#8103)

* Remove deprecated 'shape' parameter

* Remove deprecated 'shape' parameter
This commit is contained in:
WalterSumbon 2024-04-23 22:15:11 +08:00 committed by GitHub
parent 5bf61cb15b
commit aaeb9dbbb0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -150,7 +150,7 @@ def sepia(input_img):
sepia_img /= sepia_img.max()
return sepia_img
demo = gr.Interface(sepia, gr.Image(shape=(200, 200)), "image")
demo = gr.Interface(sepia, gr.Image(), "image")
demo.launch()
```
@ -161,7 +161,7 @@ demo.launch()
你也可以用 `type=` 关键字参数设置组件使用的数据类型。例如如果你想让你的函数获取一个图像的文件路径而不是一个NumPy数组时输入 `Image` 组件可以写成:
```python
gr.Image(type="filepath", shape=...)
gr.Image(type="filepath")
```
还要注意,我们的输入 `Image` 组件带有一个编辑按钮 🖉,它允许裁剪和放大图像。以这种方式操作图像可以帮助揭示机器学习模型中的偏见或隐藏的缺陷!