Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,20 +1,30 @@
|
|
1 |
import gradio as gr
|
2 |
import joblib
|
|
|
|
|
3 |
|
4 |
-
#
|
5 |
-
|
|
|
6 |
|
7 |
-
#
|
8 |
-
def
|
9 |
-
|
10 |
-
|
11 |
-
prediction
|
12 |
-
return f"Predicted numbers: {prediction}"
|
13 |
|
14 |
-
#
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
-
|
20 |
-
interface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
import joblib
|
3 |
+
from huggingface_hub import hf_hub_download
|
4 |
+
import numpy as np
|
5 |
|
6 |
+
# 从 Hugging Face 下载模型
|
7 |
+
model_path = hf_hub_download(repo_id="YDluffy/lottery_predictor_model", filename="lottery_predictor_model.pkl")
|
8 |
+
model = joblib.load(model_path)
|
9 |
|
10 |
+
# 预测函数
|
11 |
+
def predict_lottery(year, period, num1, num2, num3, num4, num5, num6, special):
|
12 |
+
features = np.array([[year, period, num1, num2, num3, num4, num5, num6, special]])
|
13 |
+
prediction = model.predict(features)
|
14 |
+
return prediction
|
|
|
15 |
|
16 |
+
# Gradio Web 界面
|
17 |
+
iface = gr.Interface(
|
18 |
+
fn=predict_lottery,
|
19 |
+
inputs=[
|
20 |
+
gr.Number(label="年份"), gr.Number(label="期数"),
|
21 |
+
gr.Number(label="号码1"), gr.Number(label="号码2"), gr.Number(label="号码3"),
|
22 |
+
gr.Number(label="号码4"), gr.Number(label="号码5"), gr.Number(label="号码6"),
|
23 |
+
gr.Number(label="特别号码")
|
24 |
+
],
|
25 |
+
outputs="text",
|
26 |
+
title="六合彩预测模型",
|
27 |
+
description="输入期号和历史开奖号码,预测下一期开奖"
|
28 |
+
)
|
29 |
|
30 |
+
iface.launch()
|
|