github-actions[bot]
Sync from GitHub e9a00339708d14fd15e64679f58d1c321b37ea9d
e71990c
Raw History Blame Contribute Delete
770 Bytes
import gradio as gr
from dotenv import load_dotenv
from src.predict import predict
load_dotenv()
demo = gr.Interface(
fn=predict,
inputs=gr.Textbox(lines=3, placeholder="Enter a news headline or article", label="Text"),
outputs=gr.Textbox(label="Predicted category"),
title="AG News Classifier",
description="Fine-tuned SciBERT model that classifies text into World, Sports, Business, or Sci/Tech.",
examples=[
"Wall Street stocks rallied after the Federal Reserve meeting.",
"The team won the championship game last night.",
"Scientists discover a new exoplanet orbiting a distant star.",
"World leaders meet to discuss climate change policy.",
],
)
if __name__ == "__main__":
demo.launch(share=True)