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)

相关推荐
栈溢出了7 分钟前
VS Code Python 自动导包失效排查笔记
开发语言·笔记·python
DanCheng-studio8 分钟前
毕业设计项目 基于深度学习的抽烟行为检测算法实现(源码分享)
python·毕业设计·毕设
Wx-bishekaifayuan21 分钟前
springboot陨石鉴收系统96265-计算机课程设计、毕业设计
java·vue.js·spring boot·后端·python·spring·课程设计
本地化文档40 分钟前
pygmt-docs-l10n
python·github·gitcode·sphinx·pygmt·gmt·crowdin
Web3&Basketball40 分钟前
用 SGLang 决策端点做毫秒级 Agent 路由
python·大模型·agent·强化学习·多模态·推理
yi01143 分钟前
DAY19: LeetCode 28 找出字符串中第一个匹配项的下标
人工智能·笔记·python·算法·leetcode
hhzz1 小时前
【YOLO 入门到精通 08】推理预测完全指南:多数据源、流式推理与性能优化
人工智能·python·yolo·计算机视觉·性能优化
benchmark_cc1 小时前
第一次补历史 K 线:按股票拆还是按日期拆请求?
python·数据分析·pandas·量化交易·股票数据·quantdash
栈溢出了1 小时前
LangGraph State 学习笔记
开发语言·人工智能·python
打工仔折腾 AI1 小时前
从零写一个CAD 04:中键拖动平移,抓住一个点让它一直待在鼠标底下
人工智能·后端·python·性能优化·计算机外设·ai agent 实战