Streamlit: Dễ dàng xây dựng giao diện web cho mô hình học máy
Streamlit: Dễ dàng xây dựng giao diện web cho mô hình học máy
🔹 1. Tại sao chọn Streamlit?
🛠️ 2. Cách sử dụng cơ bản
import streamlit as st
from sklearn.datasets import load_iris
from sklearn.ensemble import RandomForestClassifier
# Load dữ liệu
iris = load_iris()
X = iris.data
y = iris.target
# Train model
model = RandomForestClassifier()
model.fit(X, y)
# Giao diện người dùng
st.title("Dự đoán Loài Hoa Iris 🌸")
sepal_length = st.slider("Sepal length", 4.0, 8.0)
sepal_width = st.slider("Sepal width", 2.0, 4.5)
petal_length = st.slider("Petal length", 1.0, 7.0)
petal_width = st.slider("Petal width", 0.1, 2.5)
prediction = model.predict([[sepal_length, sepal_width, petal_length, petal_width]])
st.write("### Dự đoán:")
st.write(iris.target_names[prediction[0]])⚙️ 3. Các tính năng nổi bật
📦 4. Triển khai ứng dụng Streamlit
📌 Ứng dụng thực tế
PreviousFlask & FastAPI: Triển khai các mô hình AI thành RESTful APINextGradio: Một thư viện xây dựng giao diện AI nhanh chóng, tương tác cao
Last updated
