File size: 770 Bytes
e71990c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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)