first push
Browse files- app/__pycache__/app.cpython-310.pyc +0 -0
- app/app.py +14 -3
app/__pycache__/app.cpython-310.pyc
ADDED
|
Binary file (799 Bytes). View file
|
|
|
app/app.py
CHANGED
|
@@ -1,7 +1,18 @@
|
|
| 1 |
from fastapi import FastAPI
|
|
|
|
|
|
|
| 2 |
|
| 3 |
app = FastAPI()
|
| 4 |
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
+
from pydantic import BaseModel
|
| 3 |
+
from transformers import pipeline
|
| 4 |
|
| 5 |
app = FastAPI()
|
| 6 |
|
| 7 |
+
# Pipeline với model của bạn
|
| 8 |
+
model_id = "phamluan/ai-auto-excute-script"
|
| 9 |
+
classifier = pipeline("text-classification", model=model_id, tokenizer=model_id)
|
| 10 |
+
|
| 11 |
+
class InputText(BaseModel):
|
| 12 |
+
text: str
|
| 13 |
+
|
| 14 |
+
@app.post("/predict")
|
| 15 |
+
def predict(data: InputText):
|
| 16 |
+
result = classifier(data.text)
|
| 17 |
+
return {"result": result}
|
| 18 |
+
|