İlk /predict Uç Noktanız
Bir modeli yükleyin ve HTTP üzerinden bir tahmin döndürün.
İlk /predict Uç Noktanız, CoddyKit'te ücretsiz bir MLOps Academy dersidir. Bu, 4 dersinin 1. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, MLOps Academy öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. MLOps Academy kursu toplamda 4 dersten oluşur.
Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.
From Notebook to API
A model in a notebook helps only you. To serve real users, you wrap it in an API that anyone can call over the network. 🚀
Why FastAPI
FastAPI is a modern Python web framework that is fast to write, validates input for you, and auto-generates interactive docs.
Install It
You need two pieces: FastAPI itself and a server to run it. Install both with pip in one line.
pip install fastapi uvicornCreate the App
Everything starts from one app object. You create a FastAPI instance and attach routes to it.
from fastapi import FastAPI
app = FastAPI()What an Endpoint Is
An endpoint is a URL your app responds to, like /predict. Each one runs a Python function when someone calls it.
Load Your Model First
Before predicting, you load the trained model from disk. Here joblib reads a saved scikit-learn model into memory.
import joblib
model = joblib.load("model.joblib")Declare the Route
You mark a function as a POST endpoint with a decorator. POST fits prediction because you send data in the request body.
@app.post("/predict")
def predict(features: list[float]):
...Run the Prediction
Inside the function you call the model. predict expects a 2D input, so you wrap the row in a list before passing it.
pred = model.predict([features])
result = pred[0]Return JSON
Whatever your function returns, FastAPI serializes to JSON automatically. Return a plain dict and the client gets clean JSON.
return {"prediction": result}Start the Server
You launch the app with uvicorn, pointing it at the module and the app object. The reload flag restarts on code changes.
uvicorn main:app --reloadTry the Auto Docs
Visit /docs in your browser and FastAPI shows an interactive page where you can test /predict without writing any client code. 🎉
Quick Check
You want clients to send feature data to your model. Which HTTP method fits a /predict endpoint?
Recap
You wrapped a model in FastAPI: create the app, load the model, expose a POST /predict that returns JSON, and run it with uvicorn. That is a live API! 🙌
Sıkça Sorulan Sorular
“İlk /predict Uç Noktanız” dersi ücretsiz mi?
Evet — “İlk /predict Uç Noktanız” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve MLOps Academy kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. MLOps Academy kursu toplamda 4 dersten oluşur.
“İlk /predict Uç Noktanız” dersinde ne öğreneceğim?
Bir modeli yükleyin ve HTTP üzerinden bir tahmin döndürün. MLOps Academy ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.
MLOps Academy öğrenmeye başlamak için deneyim gerekli mi?
Önceden deneyim gerekmez. CoddyKit'te MLOps Academy, başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 1. dersidir.
“İlk /predict Uç Noktanız” dersi ne kadar sürer?
Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.
Bu MLOps Academy dersinde kod yazıp çalıştırabilir miyim?
Evet. Her MLOps Academy dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.
Bu kursun tüm dersleri
- İlk /predict Uç Noktanız
- İstekleri Pydantic ile Doğrulayın
- Modeli Başlangıçta Bir Kez Yükleyin
- Bir /health Hazır Olma Denetimi Ekleyin