Gradio学习(一)—————启动一个demo页面

安装(Python 3.7以上版本)

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple gradio

新建一个demo文件

import gradio as gr

def greet(name):

return "hello "+name+"!"

demo=gr.Interface(fn=greet,inputs="text",output="text")

因为在虚拟机中启动,而不是pycharm 所以指定主机ip (1.1.1.1)和端口号,如果是在pycharm 中,无需指定

demo.launch(server_name="1.1.1.1",server_port=7860,share=True,inbrowser=True)

相关推荐
啵啵鱼爱吃小猫咪3 分钟前
机械臂阻抗控制github项目-mujoco仿真
开发语言·人工智能·python·机器人
MaximusCoder5 分钟前
等保测评命令——Centos Linux
linux·运维·经验分享·python·安全·centos
yunyun321236 分钟前
用Python生成艺术:分形与算法绘图
jvm·数据库·python
m0_662577978 分钟前
高级爬虫技巧:处理JavaScript渲染(Selenium)
jvm·数据库·python
songyuc23 分钟前
【PyTorch】感觉`CrossEntropyLoss`和`BCELoss`很类似,为什么它们接收labels的shape常常不一样呢?
人工智能·pytorch·python
ℳ๓₯㎕.空城旧梦39 分钟前
Python单元测试(unittest)实战指南
jvm·数据库·python
浩子智控2 小时前
python程序打包的文件地址处理
开发语言·python·pyqt
Jackey_Song_Odd2 小时前
Part 1:Python语言核心 - 序列与容器
开发语言·windows·python
m0_662577972 小时前
Python迭代器(Iterator)揭秘:for循环背后的故事
jvm·数据库·python