Spaces:
Running
Running
1.6
Browse files
app.py
CHANGED
@@ -18,9 +18,8 @@ def login_up_nft(ava_image, info):
|
|
18 |
if info is not None:
|
19 |
result, uid, key, code = get_uid_key(info)
|
20 |
if result:
|
21 |
-
image = Image.fromarray(ava_image)
|
22 |
bytes_object = io.BytesIO()
|
23 |
-
|
24 |
img_data = bytes_object.getvalue()
|
25 |
result, code = up_card(uid, key, img_data)
|
26 |
return code
|
@@ -32,10 +31,10 @@ def login_up_nft(ava_image, info):
|
|
32 |
with gr.Blocks() as demo:
|
33 |
login_info = gr.State([])
|
34 |
with gr.Tab("bili_NFT自定义头像"):
|
35 |
-
gr.Markdown("30秒自定义钻石头像(NFT)
|
36 |
gr.Markdown("""
|
37 |
使用视频教程(欢迎三连):[视频地址](https://www.bilibili.com/video/BV1t8411P7HD/)
|
38 |
-
https://www.bilibili.com/video/
|
39 |
""")
|
40 |
gr.Markdown("源码:https://huggingface.co/spaces/cynika/NFT_avatar")
|
41 |
gr.Markdown("第一步:")
|
@@ -47,8 +46,8 @@ with gr.Blocks() as demo:
|
|
47 |
with gr.Column():
|
48 |
gr.Markdown(
|
49 |
"确保第一步领取三体数字藏品后,上传新头像,头像尽量为正方形并小于1024*1024像素,然后等待生成二维码并扫码登录进行授权(左上传头像,右扫码登录))")
|
50 |
-
image_ava = gr.Image()
|
51 |
-
image_qr = gr.Image()
|
52 |
gr.Markdown("第三步:")
|
53 |
with gr.Row():
|
54 |
gr.Markdown(
|
|
|
18 |
if info is not None:
|
19 |
result, uid, key, code = get_uid_key(info)
|
20 |
if result:
|
|
|
21 |
bytes_object = io.BytesIO()
|
22 |
+
ava_image.save(bytes_object, format='PNG')
|
23 |
img_data = bytes_object.getvalue()
|
24 |
result, code = up_card(uid, key, img_data)
|
25 |
return code
|
|
|
31 |
with gr.Blocks() as demo:
|
32 |
login_info = gr.State([])
|
33 |
with gr.Tab("bili_NFT自定义头像"):
|
34 |
+
gr.Markdown("30秒自定义钻石头像(NFT),一站式操作仅三步,无需下载安装,代码开源免费,拿我项目收费的都是骗子")
|
35 |
gr.Markdown("""
|
36 |
使用视频教程(欢迎三连):[视频地址](https://www.bilibili.com/video/BV1t8411P7HD/)
|
37 |
+
https://www.bilibili.com/video/BV1t8411P7HD/
|
38 |
""")
|
39 |
gr.Markdown("源码:https://huggingface.co/spaces/cynika/NFT_avatar")
|
40 |
gr.Markdown("第一步:")
|
|
|
46 |
with gr.Column():
|
47 |
gr.Markdown(
|
48 |
"确保第一步领取三体数字藏品后,上传新头像,头像尽量为正方形并小于1024*1024像素,然后等待生成二维码并扫码登录进行授权(左上传头像,右扫码登录))")
|
49 |
+
image_ava = gr.Image(type="pil", label="上传头像")
|
50 |
+
image_qr = gr.Image(type="pil", label="b站客户端扫码登录")
|
51 |
gr.Markdown("第三步:")
|
52 |
with gr.Row():
|
53 |
gr.Markdown(
|
bili.json
CHANGED
The diff for this file is too large to render.
See raw diff
|
|
login.py
CHANGED
@@ -21,8 +21,7 @@ def catch_qr(x):
|
|
21 |
})).json()
|
22 |
# 生成二维码
|
23 |
img = qrcode.make(login_info['data']['url']).get_image().convert("RGB")
|
24 |
-
|
25 |
-
return out, login_info
|
26 |
|
27 |
|
28 |
def get_uid_key(login_info):
|
|
|
21 |
})).json()
|
22 |
# 生成二维码
|
23 |
img = qrcode.make(login_info['data']['url']).get_image().convert("RGB")
|
24 |
+
return img, login_info
|
|
|
25 |
|
26 |
|
27 |
def get_uid_key(login_info):
|
nft.py
CHANGED
@@ -77,14 +77,17 @@ def get_one_card_id(UID, ACCESS_KEY):
|
|
77 |
for card in round['card_list']:
|
78 |
if card['card_type'] == 2 and card['card_id_list']:
|
79 |
print(card['card_id_list'][0]['card_id'])
|
|
|
|
|
|
|
80 |
return card['card_id_list'][0]['card_id']
|
81 |
-
print('没有
|
82 |
for i in data["data"]["pre_list"]:
|
83 |
if card_id_list := i.get("card_id_list"):
|
84 |
for j in card_id_list:
|
85 |
if card_id := j.get("card_id"):
|
86 |
print("=================================")
|
87 |
-
print(f"
|
88 |
print("=================================")
|
89 |
return card_id
|
90 |
else:
|
|
|
77 |
for card in round['card_list']:
|
78 |
if card['card_type'] == 2 and card['card_id_list']:
|
79 |
print(card['card_id_list'][0]['card_id'])
|
80 |
+
print("=================================")
|
81 |
+
print(f"找到三体卡 card_id: {card['card_id_list'][0]['card_id']}\n这个id属于付费R级别胶囊计划")
|
82 |
+
print("=================================")
|
83 |
return card['card_id_list'][0]['card_id']
|
84 |
+
print('没有R级别胶囊计划的卡片')
|
85 |
for i in data["data"]["pre_list"]:
|
86 |
if card_id_list := i.get("card_id_list"):
|
87 |
for j in card_id_list:
|
88 |
if card_id := j.get("card_id"):
|
89 |
print("=================================")
|
90 |
+
print(f"找到预约三体卡card_id: {card_id}\n这个 id 属于 {i.get('card_name')}")
|
91 |
print("=================================")
|
92 |
return card_id
|
93 |
else:
|