Spaces:
Runtime error
Runtime error
File size: 620 Bytes
8d9bc51 a2a3c2b 8d9bc51 a2a3c2b 8d9bc51 a2a3c2b 8d9bc51 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
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() |