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)

相关推荐
smj2302_796826521 小时前
解决leetcode第3989题网格中保持一致的最大列数
python·算法·leetcode
吴梓穆2 小时前
Python 基础 正则表达式
python
巧克力男孩dd2 小时前
Python超典型练习题(第一次作业)
开发语言·python·算法
闲猫3 小时前
LangChain / Core components / Models
开发语言·python·langchain
cui_ruicheng5 小时前
Python从入门到实战(十三):模块、包与环境管理
开发语言·python
李宸净6 小时前
Web自动化测试selenium+python
前端·python·selenium
而后笑面对6 小时前
生信bwa算法
python
至乐活着7 小时前
深入Python内存管理与垃圾回收:从引用计数到分代回收的实战解析
python·性能优化·内存管理·垃圾回收·引用计数
m0_547486668 小时前
《Python数据分析与挖掘》全套PPT课件
python·数据挖掘·数据分析
㱘郳8 小时前
飞机大战Pygame存档
python·pygame