Spaces:
Sleeping
Sleeping
Download main.py from pjxcharya/batch-analyse: direct link, hf CLI and curl.
- Browser
- Download file 859 Bytes
-
https://huggingface.co/spaces/pjxcharya/batch-analyse/resolve/main/main.py
- Command line
-
hf download hf://spaces/pjxcharya/batch-analyse/main.py
-
curl -L -o main.py https://huggingface.co/spaces/pjxcharya/batch-analyse/resolve/main/main.py
859 Bytes
| from fastapi import FastAPI | |
| from pydantic import BaseModel | |
| from typing import List | |
| from core.preprocess import preprocess_text_list | |
| from core.analyzer import analyze_feedback | |
| from utils.counter import aggregate_results | |
| # ✅ NEW import (moved from severity_service) | |
| from utils.severity_classifier import classify_issues, InputPayload | |
| app = FastAPI(title="Batch Sentiment + Severity Classifier") | |
| class FeedbackBatch(BaseModel): | |
| texts: List[str] | |
| def analyze_batch_endpoint(batch: FeedbackBatch): | |
| cleaned_texts = preprocess_text_list(batch.texts) | |
| results = [analyze_feedback(text) for text in cleaned_texts if analyze_feedback(text)] | |
| summary = aggregate_results(results) | |
| return summary | |
| def classify_severity_endpoint(payload: InputPayload): | |
| return classify_issues(payload) | |