Spaces:
Sleeping
Sleeping
Commit
Β·
11c35f2
1
Parent(s):
19e90ed
removed unnecessary part - depth
Browse files
app.py
CHANGED
|
@@ -7,7 +7,7 @@ from datetime import datetime
|
|
| 7 |
genai.configure(api_key=os.environ.get('GOOGLE_API_KEY'))
|
| 8 |
model = genai.GenerativeModel('gemini-2.5-flash')
|
| 9 |
|
| 10 |
-
def get_counter_debuts(opponent_debuts, user_color, user_repertoire
|
| 11 |
|
| 12 |
if not opponent_debuts or not opponent_debuts.strip():
|
| 13 |
return "β Iltimos, kamida bitta debyt kiriting!"
|
|
@@ -19,16 +19,7 @@ def get_counter_debuts(opponent_debuts, user_color, user_repertoire, analysis_de
|
|
| 19 |
repertoire_context = ""
|
| 20 |
if user_repertoire and user_repertoire.strip():
|
| 21 |
repertoire_context = f"\n\nFOYDALANUVCHI REPERTUARI:\n{user_repertoire}\n\nIltimos, bu repertuarni hisobga olib tavsiyalar bering."
|
| 22 |
-
|
| 23 |
-
# Tahlil chuqurligiga qarab detalizatsiya
|
| 24 |
-
depth_instruction = ""
|
| 25 |
-
if analysis_depth == "Tez":
|
| 26 |
-
depth_instruction = "Qisqa va aniq javob bering (3-4 jumla har bir debyt uchun)."
|
| 27 |
-
elif analysis_depth == "O'rtacha":
|
| 28 |
-
depth_instruction = "O'rtacha batafsil javob bering (1 paragraf har bir debyt uchun)."
|
| 29 |
-
else: # Batafsil
|
| 30 |
-
depth_instruction = "Juda batafsil javob bering: variantlar, rejalar, tuzoqlar va misollar bilan."
|
| 31 |
-
|
| 32 |
prompt = f"""
|
| 33 |
Siz professional shaxmat murabbiyisiz. {color_context}
|
| 34 |
|
|
@@ -36,8 +27,6 @@ def get_counter_debuts(opponent_debuts, user_color, user_repertoire, analysis_de
|
|
| 36 |
{opponent_debuts}
|
| 37 |
{repertoire_context}
|
| 38 |
|
| 39 |
-
{depth_instruction}
|
| 40 |
-
|
| 41 |
Har bir raqib debyuti uchun quyidagilarni bering:
|
| 42 |
|
| 43 |
## DEBYT NOMI
|
|
@@ -73,8 +62,6 @@ def get_counter_debuts(opponent_debuts, user_color, user_repertoire, analysis_de
|
|
| 73 |
|
| 74 |
**Sana:** {datetime.now().strftime("%Y-%m-%d %H:%M")}
|
| 75 |
**Sizning Rangingiz:** {user_color}
|
| 76 |
-
**Tahlil Darajasi:** {analysis_depth}
|
| 77 |
-
|
| 78 |
---
|
| 79 |
|
| 80 |
{fixed_response}
|
|
@@ -132,7 +119,7 @@ def create_interface():
|
|
| 132 |
|
| 133 |
user_repertoire = gr.Textbox(
|
| 134 |
label="π Sizning Repertuaringiz (ixtiyoriy)",
|
| 135 |
-
placeholder="Misol: e4 ga qarshi men
|
| 136 |
lines=4,
|
| 137 |
info="Sizning afzal ko'rgan debyutlaringiz"
|
| 138 |
)
|
|
@@ -144,7 +131,7 @@ def create_interface():
|
|
| 144 |
|
| 145 |
gr.Examples(
|
| 146 |
examples=[
|
| 147 |
-
["Qora", "e4, London tizimi", "e4 ga qarshi
|
| 148 |
["Qora", "d4, c4", "d4 ga qarshi Grunfeld, e4 ga qarshi Karo-Kann", "Batafsil"],
|
| 149 |
["Oq", "e4, Ispancha partiya", "", "Tez"],
|
| 150 |
],
|
|
|
|
| 7 |
genai.configure(api_key=os.environ.get('GOOGLE_API_KEY'))
|
| 8 |
model = genai.GenerativeModel('gemini-2.5-flash')
|
| 9 |
|
| 10 |
+
def get_counter_debuts(opponent_debuts, user_color, user_repertoire):
|
| 11 |
|
| 12 |
if not opponent_debuts or not opponent_debuts.strip():
|
| 13 |
return "β Iltimos, kamida bitta debyt kiriting!"
|
|
|
|
| 19 |
repertoire_context = ""
|
| 20 |
if user_repertoire and user_repertoire.strip():
|
| 21 |
repertoire_context = f"\n\nFOYDALANUVCHI REPERTUARI:\n{user_repertoire}\n\nIltimos, bu repertuarni hisobga olib tavsiyalar bering."
|
| 22 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
prompt = f"""
|
| 24 |
Siz professional shaxmat murabbiyisiz. {color_context}
|
| 25 |
|
|
|
|
| 27 |
{opponent_debuts}
|
| 28 |
{repertoire_context}
|
| 29 |
|
|
|
|
|
|
|
| 30 |
Har bir raqib debyuti uchun quyidagilarni bering:
|
| 31 |
|
| 32 |
## DEBYT NOMI
|
|
|
|
| 62 |
|
| 63 |
**Sana:** {datetime.now().strftime("%Y-%m-%d %H:%M")}
|
| 64 |
**Sizning Rangingiz:** {user_color}
|
|
|
|
|
|
|
| 65 |
---
|
| 66 |
|
| 67 |
{fixed_response}
|
|
|
|
| 119 |
|
| 120 |
user_repertoire = gr.Textbox(
|
| 121 |
label="π Sizning Repertuaringiz (ixtiyoriy)",
|
| 122 |
+
placeholder="Misol: e4 ga qarshi men Sicilian o'ynayman, d4 ga qarshi Grunfeld",
|
| 123 |
lines=4,
|
| 124 |
info="Sizning afzal ko'rgan debyutlaringiz"
|
| 125 |
)
|
|
|
|
| 131 |
|
| 132 |
gr.Examples(
|
| 133 |
examples=[
|
| 134 |
+
["Qora", "e4, London tizimi", "e4 ga qarshi Sicilain, d4 ga qarshi Kings Indian", "O'rtacha"],
|
| 135 |
["Qora", "d4, c4", "d4 ga qarshi Grunfeld, e4 ga qarshi Karo-Kann", "Batafsil"],
|
| 136 |
["Oq", "e4, Ispancha partiya", "", "Tez"],
|
| 137 |
],
|