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)

相关推荐
王仔小奶10 小时前
慢SQL治理与性能调优:DBA如何用Shell/Python提升运维效率?
python·sql·dba
用户03321266636710 小时前
使用 Python 快速在 PowerPoint 中生成表格【教程】
python
夜晚回家10 小时前
Python 身份运算符详解 | is 与 == 到底差在哪
python
fengye20716110 小时前
cpython框架结构
python
用户912940468484210 小时前
大模型返回 JSON 后,先过这道 Python 校验
python
Dmz丶10 小时前
前端转 AI 100 天 Day 32:LLM 客户端工程化——重试、超时、降级、限流
python
曲径海盗10 小时前
【Python 学习第 39 天】for 循环
python·学习笔记·编程入门
万联WANFLOW11 小时前
Kimi K3.1 Pro 接口接入指南:模型选型、费用计算与零数据保留
java·spring boot·python·安全·spring·大模型
问心无愧051312 小时前
[护网杯 2018]easy_tornado
python·tornado
全栈弄潮儿12 小时前
Python实战第13期:模块与包
后端·python·编程语言