mkblvcreates's picture
download
raw
777 Bytes
# -*- coding: utf-8 -*-
"""app.py
Automatically generated by Colab.
Original file is located at
https://colab.research.google.com/drive/14li2A2e6uXyOUJztPqqlallXTtuGJTGl
"""
from fastapi import FastAPI
from pydantic import BaseModel
from transformers import pipeline
# Init FastAPI
app = FastAPI(title="FastAPI Inference Template", version="1.0")
# Example model (can be swapped out easily)
model = pipeline("sentiment-analysis")
# Request schema
class InferenceRequest(BaseModel):
text: str
# Root check
@app.get("/")
def root():
return {"status": "ok", "message": "Inference API is live"}
# Predict endpoint
@app.post("/predict")
def predict(request: InferenceRequest):
result = model(request.text)
return {"input": request.text, "output": result}

Xet Storage Details

Size:
777 Bytes
·
Xet hash:
8eb688d69287b12257a211215c54e54e1691370527caf6bf5b20757c9131c882

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.