import gradio as gr from transformers import pipeline print("Loading SiftAI RoBERTa model...") classifier = pipeline( "text-classification", model="KakoSan/siftai-roberta-final", top_k=None, ) print("Model loaded.") def classify_text(text: str): if not text or not text.strip(): return [] return classifier(text[:512]) demo = gr.Interface( fn=classify_text, inputs=gr.Textbox(label="Input Text"), outputs=gr.JSON(label="Results"), title="SiftAI Text Classifier", description="Misinformation detection via fine-tuned RoBERTa.", api_name="predict", ) if __name__ == "__main__": demo.launch()