Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import joblib
|
| 3 |
+
|
| 4 |
+
# 加载训练好的模型
|
| 5 |
+
model = joblib.load('lottery_predictor_model.pkl') # 这里假设你已经训练好并保存了模型
|
| 6 |
+
|
| 7 |
+
# 定义预测函数
|
| 8 |
+
def predict(lottery_period, date):
|
| 9 |
+
# 将期号和日期转化为模型需要的特征(这只是一个示例,实际中你需要处理数据)
|
| 10 |
+
features = [lottery_period, date]
|
| 11 |
+
prediction = model.predict([features]) # 使用模型进行预测
|
| 12 |
+
return f"Predicted numbers for {lottery_period} on {date} are: {prediction}"
|
| 13 |
+
|
| 14 |
+
# 创建 Gradio 接口
|
| 15 |
+
demo = gr.Interface(fn=predict,
|
| 16 |
+
inputs=[gr.Textbox(label="Lottery Period"), gr.Textbox(label="Date")],
|
| 17 |
+
outputs="text")
|
| 18 |
+
|
| 19 |
+
# 启动界面
|
| 20 |
+
demo.launch()
|