import streamlit as st
from datasets import load_dataset
import os
import sys
import requests
import numpy as np
import pandas as pd
import numpy as np
import random
import time
import progressbar
import json
# Set the app title
st.title('Ở đây dự đoán Vietlott 6/45 và 6/55')
# Add a welcome message
st.write('Dự đoán Vietlott xác suất trúng ít trượt nhiều - haha.')
st.write('Vì không dự đoán thì chỉ có trượt thôi :))))')
def getTop(plist):
rt = []
rtn = []
grt = 0
#st.write(len(plist))
while grt < 1:
start = 0
tmp = 0
x = 0
while x < len(plist):
if plist[x][1] >= start:
if plist[x][0] not in rtn:
start = plist[x][1]
tmp = plist[x][0]
x += 1
#st.write(tmp)
rt.append([tmp,start])
rtn.append(tmp)
grt += 1
return rt
def get6Top(plist):
rt = []
rtn = []
grt = 0
#st.write(len(plist))
while grt < 6:
start = 0
tmp = 0
x = 0
while x < len(plist):
if plist[x][1] >= start:
if plist[x][0] not in rtn:
start = plist[x][1]
tmp = plist[x][0]
x += 1
#st.write(tmp)
rt.append([tmp,start])
rtn.append(tmp)
grt += 1
return rt
def randomList(plist):
rtl = []
pidx = []
while len(pidx) < len(plist):
ridx = random.randint(0,len(plist)-1)
if ridx not in pidx:
pidx.append(ridx)
for idx in pidx:
rtl.append(plist[idx])
return rtl
# Create a text input
#user_input = st.text_input('Enter a custom message:', 'Hello, Streamlit!')
# Display the customized message
#st.write('Customized Message:', user_input)
click = 0
st.html("
Lựa chọn môn hình thức muốn chơi hôm nay nào:
")
first_button = st.button("Power 6/55",type='primary')
second_button = st.button("Mega 6/45",type="secondary")
kt = "1"
if first_button:
click = 1
st.html(
"Ấy nay chơi Power 6/55 à?
Cố trúng cái jackpot 2 là được rồi.
"
)
kt = "1"
elif second_button:
click = 1
st.write("Oánh lô nhé")
st.html(
"Vừa chọn dự đoán Mega 6/45
Ăn nhớ báo nhé.
"
)
kt = "2"
path = os.getcwd()
rolldate = []
results = []
stats = []
full_stats = []
#st.write('Current Path:', path)
if click == 1:
if kt == "1":
st.write("Quá trình tổng hợp dữ liệu ...")
rolldate = []
results = []
stats = []
full_stats = []
maxdate = ""
maxid = ""
lastresult = []
baseurl = "https://github.com/thanhnhu/vietlott/raw/refs/heads/master/data/power655.jsonl"
url = baseurl
i = 1
FILE_TO_SAVE_AS = path+"/power655.jsonl" # the name you want to save file as
resp = requests.get(url) # making requests to server
with open(FILE_TO_SAVE_AS, "wb") as f:
f.write(resp.content) # writing content to file
fo = open(FILE_TO_SAVE_AS)
i = 1
lines = fo.readlines()
bar = progressbar.ProgressBar(maxval=len(lines), \
widgets=[progressbar.Bar('=', '[', ']'), ' ', progressbar.Percentage()])
bar.start()
for l in lines:
y = json.loads(l.strip())
#st.write(green+"\t"+y['date']+"\t"+y["id"]+"\t"+str(y["result"]))
maxdate = y['date']
maxid = y["id"]
lastresult = y["result"]
rolldate.append(y['date'])
results.append(y["result"])
bar.update(i+1)
fo.close()
bar.finish()
#st.write(str(len(rolldate)))
#st.write(str(len(results)))
st.write("Kỳ quay cuối cùng: :blue["+maxid+"] ngày: :blue["+maxdate+"] - kết quả: :blue["+str(lastresult)+"]")
# ws = open(path+"\\power.txt","w+")
# i = 0
# ws.write("NUM 1\tNUM 2\tNUM 3\tNUM 4\tNUM 5\tNUM 6\tNUM RP\n")
# while i < len(rolldate):
# if len(results[i])==7:
# vdata = ""
# for rs in results[i]:
# vdata += "\t"+str(rs)
# vdata = vdata.strip()+"\n"
# ws.write(vdata)
# i += 1
# ws.close()
else:
st.write("Bạn đã lựa chọn dự đoán Mega 645\n")
rolldate = []
results = []
stats = []
full_stats = []
maxdate = ""
maxid = ""
lastresult = []
baseurl = "https://github.com/thanhnhu/vietlott/raw/refs/heads/master/data/power645.jsonl"
url = baseurl
i = 1
FILE_TO_SAVE_AS = path+"/power645.jsonl" # the name you want to save file as
resp = requests.get(url) # making requests to server
with open(FILE_TO_SAVE_AS, "wb") as f:
f.write(resp.content) # writing content to file
fo = open(FILE_TO_SAVE_AS)
i = 1
lines = fo.readlines()
bar = progressbar.ProgressBar(maxval=len(lines), \
widgets=[progressbar.Bar('=', '[', ']'), ' ', progressbar.Percentage()])
bar.start()
for l in lines:
y = json.loads(l.strip())
#st.write(green+"\t"+y['date']+"\t"+y["id"]+"\t"+str(y["result"]))
maxdate = y['date']
maxid = y["id"]
lastresult = y["result"]
rolldate.append(y['date'])
results.append(y["result"])
bar.update(i+1)
fo.close()
bar.finish()
#st.write(str(len(rolldate)))
#st.write(str(len(results)))
st.write("Kỳ quay cuối cùng: :blue["+maxid+"] ngày: :blue["+maxdate+"] - kết quả: :blue["+str(lastresult)+"]")
i = 0
# ws.write("NUM 1\tNUM 2\tNUM 3\tNUM 4\tNUM 5\tNUM 6\n")
while i < len(rolldate):
#if len(results[i])==6:
#vdata = ""
for rs in results[i]:
stats.append(rs)
i += 1
for dt in list(set(stats)):
full_stats.append([dt,stats.count(dt)])
t6 = get6Top(full_stats)
st.write(f"Top 6 số hay về nhất (số, lượt): **"+str(t6)+"**")
t6s = randomList(t6)
ridx = random.randint(0,len(t6s)-1)
top1 = t6s[ridx]
stat_link = []
for z in results:
if top1[0] in z:
for x1 in z:
if x1 != top1[0]:
stat_link.append(x1)
sts = []
for x in list(set(stat_link)):
sts.append([x,stat_link.count(x)])
top2 = getTop(sts)[0]
stat_link = []
for z in results:
if top2[0] in z:
for x1 in z:
if x1 != top2[0] and x1 != top1[0]:
stat_link.append(x1)
sts = []
for x in list(set(stat_link)):
sts.append([x,stat_link.count(x)])
top3 = getTop(sts)[0]
stat_link = []
for z in results:
if top3[0] in z:
for x1 in z:
if x1 != top2[0] and x1 != top1[0] and x1 != top3[0]:
stat_link.append(x1)
sts = []
for x in list(set(stat_link)):
sts.append([x,stat_link.count(x)])
top4 = getTop(sts)[0]
stat_link = []
for z in results:
if top4[0] in z:
for x1 in z:
if x1 != top2[0] and x1 != top1[0] and x1 != top3[0] and x1 != top4[0]:
stat_link.append(x1)
sts = []
for x in list(set(stat_link)):
sts.append([x,stat_link.count(x)])
top5 = getTop(sts)[0]
stat_link = []
for z in results:
if top5[0] in z:
for x1 in z:
if x1 != top2[0] and x1 != top1[0] and x1 != top3[0] and x1 != top4[0] and x1 != top5[0]:
stat_link.append(x1)
sts = []
for x in list(set(stat_link)):
sts.append([x,stat_link.count(x)])
top6 = getTop(sts)[0]
soutput = "Dãy số dự đoán là: **:red["+str(top1[0])+"]** ("+str(top1[1])+") **:red[" +str(top2[0])+"]** ("+str(top2[1])+") "
soutput+=" **:red["+str(top3[0])+"]** ("+str(top3[1])+") **:red["+str(top4[0])+"]** ("+str(top4[1])+") **:red[" +str(top5[0])+"]** ("+str(top5[1])+") **:red["+str(top6[0])+"]** ("+str(top6[1])+") "
st.write(soutput)
st.html(
"Này này, chơi mà trúng là phải chia lộc đấy nhé, ghi log hết rồi nhé, nuốt hết là ko trôi đâu.
"
+ "
"
)
st.link_button("Chia lộc ở đây", "https://www.paypal.com/ncp/payment/MHKWQ9BEP2Y34")