Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| from transformers import pipeline | |
| model = pipeline("text-classification", model="xlm-roberta-large") | |
| def decision_making(option1, option2): | |
| options = [option1, option2] | |
| result = model(options, return_all_scores=True) | |
| if result[0]['score'] > result[1]['score']: | |
| return f"The AI chooses {option1}." | |
| else: | |
| return f"The AI chooses {option2}." | |
| iface = gr.Interface(fn=decision_making, inputs=["text", "text"], outputs="text", title="Decision Making with XLM-RoBERTa-Large", | |
| description="Enter two options and the AI will choose one.") | |
| iface.launch() |