File size: 1,079 Bytes
90e449e 1607e47 df8f6e7 90e449e df8f6e7 1607e47 3d3e0b2 1607e47 64dea2b 1607e47 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
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',
example=[
[
"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() |