Logo Lanfrica

ba5liel/Amharic_News_Category_Classification_Flask

Domain:

natural language processing

Record type:

software
Creator:
ba5
Host:
Amharic_News_Category_Classification_Flask # Amharic News Category Classification API This Flask application provides an API endpoint for classifying Amharic news articles into categories using a fine-tuned transformer model. ## Group Memebers 1. Basliel Selamu ATE/6761/13 2. Bethel Wondowssen ATE/8712/13 3. Dibora Dereje ATE/1712/13 4. Amanuel Ayalew ATE/3871/13 5. Abdurahman Mohammed ATE/8901/13 ## Prerequisites - Python 3.7+ - PyTorch - Transformers library - Flask ## Installation 1. Clone the repository: ```bash git clone github.com cd Amharic_News_Category_Classification_Flask ``` 2. Install the required dependencies: ```bash pip install flask torch transformers ``` 3. Make sure you have the fine-tuned model in the correct location: - The model should be in the `./finetuned_model_local` directory - If you don't have the model, you'll need to fine-tune it first or obtain it from the model provider ## Running the Application 1. Start the Flask server: ```bash python infer.py ``` The server will start on `0.0.0.0` ## API Usage ### Classify News Article **Endpoint:** `/classify` **Method:** POST **Content-Type:** application/json **Request Body:** ```json { "headline": "Your Amharic news headline here", "article": "Your Amharic news article content here" } ``` **Example Request:** ```bash curl -X POST localhost \ -H "Content-Type: application/json" \ -d '{ "headline": "የአማራ ክልል መንግስት ከአዲስ አበባ ጋር የሚያገናኙ መንገዶችን እንደሚያስፋፋ አስታወቀ", "article": "የአማራ ክልል መንግስት ከአዲስ አበባ ጋር የሚያገናኙ መንገዶችን ለማስፋፋት እንቅስቃሴ እየተደረገ መሆኑን አስታውቋል..." }' ``` **Example Response:** ```json { "classification": "politics" } ``` ## Error Handling The API will return appropriate error messages if: - The request body is missing - Required fields (headline or article) are missing - The model directory is not found - Any processing errors occur during classification ## Notes - The model use …