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)

相关推荐
人工智能时代 准备好了吗13 小时前
AI回答内容进入率监测:引用识别、文本匹配与语义判断
开发语言·人工智能·python
言乐614 小时前
Python实现建造微服务商城后台
开发语言·python·算法·微服务·架构
fenglllle15 小时前
chromadb emmbedding 向量检索
人工智能·python·embedding
cui_ruicheng15 小时前
Python从入门到实战(六):非序列容器
开发语言·python
百里香酚兰15 小时前
【python学习笔记】pyttsx3库疑似只播报一次语音
笔记·python·学习
飞猪~15 小时前
Langchain python版本 LLM 重要函数invoke,ainvoke,stream,astream,batch,abatch
python·langchain·batch
沙蒿同学16 小时前
当古诗词遇上 AI:从 38 万句诗词中取一个好名字
python·算法·架构
xxie12379416 小时前
Python装饰器与语法糖
开发语言·python
CClaris17 小时前
大模型量化从0到1(五):GPTQ 原理详解 + 从零量化一个真实大模型
人工智能·python·算法·机器学习
Railshiqian17 小时前
UserPickerActivity 内部逻辑分析
开发语言·python