Spaces:
Sleeping
Sleeping
import gradio as gr | |
import joblib | |
from huggingface_hub import hf_hub_download | |
import numpy as np | |
# 从 Hugging Face 下载模型 | |
model_path = hf_hub_download(repo_id="YDluffy/lottery_predictor_model", filename="lottery_predictor_model.pkl") | |
model = joblib.load(model_path) | |
# 预测函数 | |
def predict_lottery(year, period, num1, num2, num3, num4, num5, num6, special): | |
features = np.array([[year, period, num1, num2, num3, num4, num5, num6, special]]) | |
prediction = model.predict(features) | |
return prediction | |
# Gradio Web 界面 | |
iface = gr.Interface( | |
fn=predict_lottery, | |
inputs=[ | |
gr.Number(label="年份"), gr.Number(label="期数"), | |
gr.Number(label="号码1"), gr.Number(label="号码2"), gr.Number(label="号码3"), | |
gr.Number(label="号码4"), gr.Number(label="号码5"), gr.Number(label="号码6"), | |
gr.Number(label="特别号码") | |
], | |
outputs="text", | |
title="六合彩预测模型", | |
description="输入期号和历史开奖号码,预测下一期开奖" | |
) | |
iface.launch() | |