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)

相关推荐
zhanghongyi_cpp3 小时前
4. “3+3”高考选考科目问题
python
知识中的海王5 小时前
js逆向入门图灵爬虫练习平台第六题
python
碳基学AI6 小时前
北京大学DeepSeek内部研讨系列:AI在新媒体运营中的应用与挑战|122页PPT下载方法
大数据·人工智能·python·算法·ai·新媒体运营·产品运营
forestsea6 小时前
Python进阶编程总结
开发语言·python·notepad++
袖清暮雨6 小时前
Python刷题笔记
笔记·python·算法
乌旭7 小时前
AI芯片混战:GPU vs TPU vs NPU的算力与能效博弈
人工智能·pytorch·python·深度学习·机器学习·ai·ai编程
MinggeQingchun8 小时前
Python - 爬虫-网页抓取数据-库requests
爬虫·python·requests
拓端研究室TRL8 小时前
Python贝叶斯回归、强化学习分析医疗健康数据拟合截断删失数据与参数估计3实例
开发语言·人工智能·python·数据挖掘·回归
wolf犭良9 小时前
27、Python 数据库操作入门(SQLite)从基础到实战精讲
数据库·python·sqlite