Spaces:
Running on Zero
Running on Zero
Download app.py from Evasim/Simple-Text-Classifier: direct link, hf CLI and curl.
- Browser
- Download file 770 Bytes
-
https://huggingface.co/spaces/Evasim/Simple-Text-Classifier/resolve/main/app.py
- Command line
-
hf download hf://spaces/Evasim/Simple-Text-Classifier/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Evasim/Simple-Text-Classifier/resolve/main/app.py
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) | |