Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -47,8 +47,8 @@ ERROR_SUGGESTIONS = {
|
|
47 |
"example": "Doğru kullanım:\n```python\nwith open('dosya.txt', 'r') as file:\n content = file.read()\n```"
|
48 |
},
|
49 |
"OverflowError": {
|
50 |
-
|
51 |
-
|
52 |
},
|
53 |
"ValueError": {
|
54 |
"suggestion": "Veri tipi yanlış. Verilen veri beklenmeyen bir tipte olabilir.",
|
@@ -69,7 +69,7 @@ def analyze_code(code):
|
|
69 |
suggestion = ERROR_SUGGESTIONS.get(error_type, {"suggestion": "Bu hata için özel bir çözümümüz yok.", "example": ""})
|
70 |
|
71 |
# Yapay zeka destekli analiz: Hata türüne göre yapay zeka açıklaması
|
72 |
-
|
73 |
ai_response = ai_analyzer(ai_prompt, max_length=150)[0]['generated_text']
|
74 |
|
75 |
# Çözüm önerisi ve doğru kullanım örneği
|
|
|
47 |
"example": "Doğru kullanım:\n```python\nwith open('dosya.txt', 'r') as file:\n content = file.read()\n```"
|
48 |
},
|
49 |
"OverflowError": {
|
50 |
+
"suggestion": "Bir sayı matematiksel olarak çok büyük veya küçük. Hesaplama sınırlarını aşmış olabilir.",
|
51 |
+
"example": "Doğru kullanım:\n```python\nimport math\nprint(math.exp(10))\n```"
|
52 |
},
|
53 |
"ValueError": {
|
54 |
"suggestion": "Veri tipi yanlış. Verilen veri beklenmeyen bir tipte olabilir.",
|
|
|
69 |
suggestion = ERROR_SUGGESTIONS.get(error_type, {"suggestion": "Bu hata için özel bir çözümümüz yok.", "example": ""})
|
70 |
|
71 |
# Yapay zeka destekli analiz: Hata türüne göre yapay zeka açıklaması
|
72 |
+
ai_prompt = f"Python'da '{error_type}' hatası oluştu. Hata mesajı: {error_message}. Bu hata ne anlama gelir ve nasıl çözülür?"
|
73 |
ai_response = ai_analyzer(ai_prompt, max_length=150)[0]['generated_text']
|
74 |
|
75 |
# Çözüm önerisi ve doğru kullanım örneği
|