Spaces:
Sleeping
Sleeping
| 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() |