MrSimple07 commited on
Commit
832c6b9
Β·
1 Parent(s): 7a49157

first checking commit

Browse files
Files changed (2) hide show
  1. app.py +75 -0
  2. requirements.txt +1 -0
app.py ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import google.generativeai as genai
2
+ import os
3
+
4
+ # Gemini AI ni sozlash
5
+ genai.configure(api_key=os.environ.get('GEMINI_API_KEY'))
6
+ model = genai.GenerativeModel('gemini-2.5-flash')
7
+
8
+ def get_counter_debuts(opponent_debuts):
9
+ """Raqib debyutlariga qarshi eng yaxshi debyutlarni olish"""
10
+
11
+ prompt = f"""
12
+ Siz professional shaxmat murabbiyisiz. Raqib quyidagi debyutlarni o'ynaydi:
13
+
14
+ {opponent_debuts}
15
+
16
+ Ushbu debyutlarga qarshi eng samarali qarshi debyutlarni tavsiya qiling.
17
+ Har bir debyt uchun:
18
+ 1. Qarshi debyt nomi
19
+ 2. Qisqacha tushuntirish (2-3 jumla)
20
+ 3. Asosiy g'oya va rejalar
21
+
22
+ Javobni o'zbek tilida bering. Aniq va tushunarli yozing.
23
+ """
24
+
25
+ try:
26
+ response = model.generate_content(prompt)
27
+ return response.text
28
+ except Exception as e:
29
+ return f"Xatolik yuz berdi: {str(e)}"
30
+
31
+ def main():
32
+ print("=" * 60)
33
+ print("πŸ† SHAXMAT DEBYUT MASLAHATCHI πŸ†")
34
+ print("=" * 60)
35
+ print()
36
+
37
+ while True:
38
+ print("\nπŸ“‹ Raqibingiz qanday debyutlarni o'ynaydi?")
39
+ print("(Bir nechta debyutni vergul bilan ajratib kiriting)")
40
+ print("Misol: Italian oyini, Fransuz mudofaasi, Grunfeld")
41
+ print()
42
+
43
+ opponent_debuts = input("Debyutlar: ").strip()
44
+
45
+ if not opponent_debuts:
46
+ print("\n❌ Iltimos, kamida bitta debyt kiriting!")
47
+ continue
48
+
49
+ print("\n⏳ Tahlil qilinmoqda...")
50
+ print()
51
+
52
+ result = get_counter_debuts(opponent_debuts)
53
+
54
+ print("=" * 60)
55
+ print("πŸ“Š TAVSIYA ETILADIGAN QARSHI DEBYUTLAR")
56
+ print("=" * 60)
57
+ print()
58
+ print(result)
59
+ print()
60
+ print("=" * 60)
61
+
62
+ # Yana bir bor so'rash
63
+ choice = input("\nπŸ”„ Yana tahlil qilishni xohlaysizmi? (ha/yo'q): ").strip().lower()
64
+
65
+ if choice not in ['ha', 'xa', 'h', 'yes', 'y']:
66
+ print("\nβœ… Omad tilaymiz! Yaxshi o'ynang! 🎯")
67
+ break
68
+
69
+ if __name__ == "__main__":
70
+ # API kalitini tekshirish
71
+ if not os.environ.get('GEMINI_API_KEY'):
72
+ print("⚠️ GEMINI_API_KEY muhit o'zgaruvchisini o'rnating!")
73
+ print("Misol: export GEMINI_API_KEY='sizning_kalitingiz'")
74
+ else:
75
+ main()
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ google-generativeai>=0.3.0