test / demo.py
zzh2004's picture
Upload folder using huggingface_hub
89ebd71 verified
raw
history blame contribute delete
433 Bytes
import gradio as gr
from transformers import pipeline
# 创建一个pipeline对象,并指定使用GPU(设备编号为0)
qa_pipeline = pipeline("text-classification", model="uer/roberta-base-finetuned-dianping-chinese", device=0)
# 使用该pipeline创建Gradio接口并启动
interface = gr.Interface.from_pipeline(qa_pipeline)
interface.launch(share=True, server_name="0.0.0.0", server_port=7790)