Haiss123 commited on
Commit
f307059
·
verified ·
1 Parent(s): 6211590

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -1
app.py CHANGED
@@ -44,7 +44,25 @@ def predict_vihatet5(comment: str, prefix: str = "hate-speech-detection"):
44
  output_ids = model.generate(**inputs, max_length=50)
45
  output = tokenizer.decode(output_ids[0], skip_special_tokens=True)
46
  return output
47
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  # API route
49
  @app.post("/predict")
50
  def predict(input_data: CommentInput):
 
44
  output_ids = model.generate(**inputs, max_length=50)
45
  output = tokenizer.decode(output_ids[0], skip_special_tokens=True)
46
  return output
47
+ @app.get("/")
48
+ async def root():
49
+ """Health check endpoint with comprehensive API documentation"""
50
+ return {
51
+ "endpoints": {
52
+ "POSR /predict": {
53
+ "Resquest body": {
54
+ "input": "string",
55
+ "prefix": "hate-speech-detection or toxic-speech-detection"
56
+ },
57
+ "Response": {
58
+ "input": "string",
59
+ "prefix": "hate-speech-detection or toxic-speech-detection",
60
+ "prediction": "offensive,hate,..."
61
+
62
+ }
63
+ }
64
+ }
65
+ }
66
  # API route
67
  @app.post("/predict")
68
  def predict(input_data: CommentInput):