Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| title = "Tagalog RoBERTa" | |
| description = "<p style='text-align: center'>Tagalog Gradio Demo for RoBERTa. To use it, simply add your text, or click one of the examples to load them.</p>" | |
| article = "<p style='text-align: center'>Improving Large-scale Language Models and Resources for Filipino,Jan Christian Blaise Cruz and Charibeth Cheng,arXiv preprint arXiv:2111.06053,2021</p>" | |
| examples = [ | |
| ['Makulay ang <mask> na suot ni Roberta.','roberta-tagalog-base'], | |
| ['Nakakasilaw ang sikat ng <mask>.', 'roberta-tagalog-large'], | |
| ['Malakas ang buhos ng <mask>.', 'roberta-tagalog-large' ] | |
| ] | |
| i1 = gr.Interface.load("huggingface/jcblaise/roberta-tagalog-base") | |
| i2 = gr.Interface.load("huggingface/jcblaise/roberta-tagalog-large") | |
| def inference(inputtext, model): | |
| if model == "roberta-tagalog-base": | |
| outlabel = i1(inputtext) | |
| if model == "roberta-tagalog-large": | |
| outlabel = i2(inputtext) | |
| return outlabel | |
| gr.Interface( | |
| inference, | |
| [gr.inputs.Textbox(label="Input text",lines=10),gr.inputs.Dropdown(choices=["roberta-tagalog-base","roberta-tagalog-large"], type="value", default="roberta-tagalog-base", label="model")], | |
| [gr.outputs.Label(label="Output")], | |
| examples=examples, | |
| article=article, | |
| title=title, | |
| description=description).launch(enable_queue=False) |