Spaces:
Sleeping
Sleeping
File size: 430 Bytes
1bbdaf0 ed17db9 1bbdaf0 ff68214 1bbdaf0 ff68214 ed17db9 ff68214 ed17db9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import gradio as gr
from transformers import pipeline
pipeline = pipeline(task="sentiment-analysis")
def predict(input_text):
predictions = pipeline(input_text)
return input_text, {p["label"]: p["score"] for p in predictions}
gradio_app = gr.Interface(
fn=predict,
inputs="text",
outputs="text",
title="我能做文本的情绪二分类",
)
if __name__ == "__main__":
gradio_app.launch(share=True) |