File size: 3,104 Bytes
0c95b8d
 
54fdac7
 
 
054c349
54fdac7
500ef8a
c30ca89
e530bd7
500ef8a
 
0c95b8d
2816efd
54fdac7
3d08d61
2816efd
 
 
3d08d61
2816efd
 
054c349
54fdac7
 
 
 
3d08d61
bb06bb4
054c349
2816efd
54fdac7
bb06bb4
 
 
54fdac7
bb06bb4
54fdac7
 
 
bb06bb4
 
19ccaae
bb06bb4
 
2c0bb01
54fdac7
 
2816efd
54fdac7
 
2816efd
 
 
 
 
54fdac7
 
2816efd
 
 
 
 
 
 
 
 
 
 
54fdac7
 
 
bb06bb4
2816efd
 
 
 
 
 
 
 
 
 
 
54fdac7
 
 
 
 
054c349
54fdac7
054c349
2816efd
054c349
2816efd
 
054c349
2816efd
 
54fdac7
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import gradio as gr
import chess
import chess.pgn
import io
import requests
from collections import defaultdict
import os
import logging
from core.core import analyze_games

logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
logger = logging.getLogger(__name__)

with gr.Blocks(title="Chess Study Plan Pro", theme=gr.themes.Soft()) as demo:
    gr.Markdown("""
    # β™ŸοΈ Professional Shaxmat O'quv Rejasi
    
    ### To'liq tahlil va shaxsiy o'quv rejasi:
    - πŸ“Š Batafsil statistika (debyutlar, ranglar, natijalar)
    - 🎯 Zaif tomonlaringiz tahlili
    - πŸ€– AI murabbiy tavsiyalari
    - πŸ“š Kitoblar va kurslar tavsiyasi
    - 🧩 Lichess mashq masalalari
    """)
    
    with gr.Row():
        with gr.Column():
            gr.Markdown("### 🌐 Chess.com dan tahlil (Hozircha Chess Com, keyinchalik Uzchess API ulanadi)")
            username_chesscom = gr.Textbox(
                label="Chess.com foydalanuvchi nomi",
                placeholder="Foydalanuvchi nomini kiriting",
            )
        
        with gr.Column():
            gr.Markdown("### πŸ“ PGN fayl yuklash")
            pgn_upload = gr.File(
                label="PGN faylni yuklang",
                file_types=[".pgn"],
                type="binary"
            )
            username_pgn = gr.Textbox(
                label="Foydalanuvchi nomi (PGN uchun)",
                placeholder="PGN dagi o'yinchi nomi",
            )
    
    analyze_btn = gr.Button("πŸ” Tahlil qilish", variant="primary", size="lg")
    
    with gr.Row():
        stats_output = gr.Markdown(label="Statistika")
    
    with gr.Row():
        ai_output = gr.Markdown(label="AI Tahlil")
    
    gr.Markdown("---")
    
    puzzle_header = gr.Markdown()
    
    with gr.Row():
        with gr.Column():
            puzzle1_info = gr.Markdown()
            puzzle1_board = gr.HTML()
        
        with gr.Column():
            puzzle2_info = gr.Markdown()
            puzzle2_board = gr.HTML()
        
        with gr.Column():
            puzzle3_info = gr.Markdown()
            puzzle3_board = gr.HTML()
    
    analyze_btn.click(
        fn=analyze_games,
        inputs=[username_chesscom, pgn_upload, username_pgn],
        outputs=[
            stats_output,
            ai_output,
            puzzle_header,
            puzzle1_info,
            puzzle1_board,
            puzzle2_info,
            puzzle2_board,
            puzzle3_info,
            puzzle3_board
        ]
    )
    
    gr.Markdown("""
    ---
    ### πŸ“ Qanday foydalanish:
    - **Chess.com:** Foydalanuvchi nomingizni kiriting (oxirgi 30-50 ta o'yin tahlil qilinadi)
    - **Lichess:** Profile β†’ Games β†’ Export orqali PGN faylni yuklang
    - **Masalalar:** Lichess.org saytida mashq qiling
    
    ### 🎯 Xususiyatlar:
    - βœ… Debyut statistikasi (qaysi debyutlarda yaxshi/yomon o'ynaysiz)
    - βœ… Oq/Qora rang bo'yicha natijalar
    - βœ… Lichess mashq havolalari
    - βœ… Shaxsiy o'quv rejasi (kundalik mashg'ulotlar)
    - βœ… Kitoblar va kurslar tavsiyasi
    """)

demo.launch()