|
import gradio as gr |
|
from transformers import pipeline |
|
import os |
|
|
|
token = os.environ.get("HF_TOKEN") |
|
|
|
pipe = pipeline("text-classification", model="herzlicemi/37a0-5klk-3rla-0", token=token) |
|
|
|
def predict(text): |
|
return str(pipe(text)) |
|
|
|
demo = gr.Interface( |
|
fn=predict, |
|
inputs='text', |
|
outputs='text', |
|
examples=[ |
|
[ |
|
"I arrived in Bali in the morning, after a long flight from my home country. As I stepped out of the airport, I was immediately struck by the warm, humid air and the sound of birds chirping in the trees. I was greeted by a friendly taxi driver who offered to take me to my hotel in Kuta, a popular beach town on the south coast of the island." |
|
], |
|
[ |
|
"Upon my arrival in Bali in the morning, it was already late according to the time zone of my hometown after a long journey. On coming out of the airport I felt the steam hot air and the song of the singing insects in the trees. A kind taxi driver gave me a ride to a resort at Kuta – beach town located on the southern coast of the island." |
|
] |
|
] |
|
) |
|
|
|
demo.launch() |