cwchang's picture
Create app.py
c9e10c9
import gradio as gr
from transformers import pipeline
classifier = pipeline(task='text-classification', model='cwchang/text-classification-model-multilingual', device=-1)
def classify(text):
return classifier(text)[0]["label"]
demo = gr.Interface(
fn=classify,
inputs=gr.Textbox(placeholder="Please enter the text..."),
outputs="label",
examples=[
["What's the weather like today?"],
["Set an alarm for 7 AM tomorrow"],
["Call Mom"],
["Send a text to Alex saying, 'I'll be there in 15 minutes'"],
["Play some relaxing music"],
["Remind me to buy milk when I'm at the grocery store"],
["How do I get to the nearest coffee shop?"],
["What's the latest news?"],
["Translate 'thank you' into Spanish"],
["Add a meeting to my calendar for next Monday at 3 PM"],
["查詢今天的空氣品質指數"],
["明早八點鐘設一個鬧鐘"],
["給老闆發一封電子郵件,確認下週會議的時間"],
["給李明打個電話,問他晚餐時間是否方便"],
["播放一首運動時的動感音樂"],
["我到圖書館時,提醒我還書"],
["告訴我到最近的郵局怎麼走"],
["播報一下今天的頭條新聞"],
["將“生日快樂”翻譯成法語"],
["在下週三上午10點的日程中加入牙醫預約"],]
)
demo.launch()