harshraj21's picture
Deploy TruthShield AI backend
ec18e86 verified
|
Raw
History Blame Contribute Delete
992 Bytes

TruthShield ML Backend

Local FastAPI inference service for the trained EfficientNet-B0 AIGC image detector and RoBERTa M4 text detector.

Start

python -m uvicorn backend.app:app --host 127.0.0.1 --port 8010 --reload

The React app calls:

http://127.0.0.1:8010/predict-image
http://127.0.0.1:8010/predict-text

Class Order

The checkpoint only contains weights, not class_to_idx. The default class order is:

real,fake

That matches the Hugging Face AIGC benchmark labels used for the new model: 0 = real, 1 = fake.

If predictions look reversed, restart with:

$env:TRUTHSHIELD_CLASS_ORDER="fake,real"
python -m uvicorn backend.app:app --host 127.0.0.1 --port 8010 --reload

Text Model

The default text model folder is:

ML/text/truthshield_text_roberta_m4

The default text class order is:

human,ai

That matches the training labels: 0 = human-written, 1 = AI-generated.