| import gradio as gr |
| from setfit import AbsaModel |
|
|
| description = "INDO ABSA SETFIT RESTAURANT" |
| title = "INDO ABSA SETFIT RESTAURANT" |
| examples = [["Harganya sangat masuk akal untuk makanan pembuka dan makanannya yang kami makan."]] |
|
|
| model = AbsaModel.from_pretrained( |
| "zeroix07/indo-setfit-absa-model-aspect", |
| "zeroix07/indo-setfit-absa-model-polarity", |
| spacy_model="id_core_news_trf", |
| ) |
| def analyze_text(text): |
| pred = model.predict(text) |
| return pred |
| |
| interface = gr.Interface( |
| fn=analyze_text, |
| inputs="textbox", |
| outputs="text", |
| description=description, |
| title=title, |
| examples=examples |
| ) |
|
|
| interface.launch() |
|
|