File size: 23,889 Bytes
6bc66b8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
import streamlit as st
import re
import numpy as np
import matplotlib.pyplot as plt
from io import BytesIO

def run_turkish():
    # Başlık
    st.title("Note Analyzer Streamlit Uygulaması")

    # Uygulamanın çalışma prensibi görüntüleme durumu
    if "show_images" not in st.session_state:
        st.session_state.show_images = True  # Varsayılan olarak resimler gösterilsin

    # Kullanıcıdan veri alma (Sidebar sabit kalıyor)
    st.sidebar.header("Girdi Alanları")

    # Dosya yükleme veya metin girişi seçimi
    input_method = st.sidebar.radio(
        "Notları nasıl gireceksiniz?",
        options=["Dosya Yükle", "Kopyala-Yapıştır"]
    )

    uploaded_file = None
    text_input = None

    if input_method == "Dosya Yükle":
        uploaded_file = st.sidebar.file_uploader("Notlar Dosyasını Yükleyin (TXT)", type=["txt"])
    elif input_method == "Kopyala-Yapıştır":
        text_input = st.sidebar.text_area("Notları Yapıştırın", height=200)

    # Diğer parametreler
    lecture_name = st.sidebar.text_input("Ders Adı", value="Ders Adı")
    perfect_score = st.sidebar.number_input("Sınav Puanı Üst Limiti", value=100, step=1)
    my_note = st.sidebar.number_input("Benim Notum", value=0.0, step=0.1)
    note_s_axis_diff = st.sidebar.number_input("Notlar X Ekseni Ortak Farkı", value=5, step=1)
    amount_s_axis_diff = st.sidebar.number_input("Miktar Y Ekseni Ortak Farkı", value=1, step=1)
    first_step = st.sidebar.number_input("İlk Adım", value=0, step=1)
    increase_amount = st.sidebar.number_input("Artış Miktarı", value=1, step=1)

    if st.sidebar.button("Analizi Çalıştır"):
        # Butona basıldığında resimleri gizle
        st.session_state.show_images = False

    # Resimler yalnızca show_images True ise gösterilir
    if st.session_state.show_images:
        st.subheader("Uygulamanın Çalışma Prensibi")

        # Resimlerin dosya isimlerini sırayla listele
        image_files = ["turkish/a.png", "turkish/b.png", "turkish/c.png", "turkish/d.png"]

        # Resimleri alt alta ekle
        for image_file in image_files:
            st.image(image_file, use_container_width=True)

    # Notları yükleme ve işleme işlemleri (Butona basıldıysa çalışır)
    if not st.session_state.show_images:
        if input_method == "Dosya Yükle" and uploaded_file is None:
            st.error("Lütfen bir dosya yükleyin!")
        elif input_method == "Kopyala-Yapıştır" and not text_input:
            st.error("Lütfen notları metin kutusuna yapıştırın!")
        else:
            try:
                # Dosya veya metin kutusundan içerik okuma
                if uploaded_file:
                    content = uploaded_file.read().decode("utf-8")
                elif text_input:
                    content = text_input

                # Veriyi işleme
                content = content.strip()
                result = re.split(r'[ \n]+', content)

                # Strip fonksiyonu ve kaçış dizisi temizliği
                notes_result = [x.strip() for x in result[first_step::increase_amount] if x.strip() != '∅' and x.strip() != "NA"]
                notes_result = list(map(lambda x: float(x), notes_result))
                notes_result = np.array(notes_result)

                # İstatistikler
                average_x = np.average(notes_result)
                min_x = notes_result.min()
                max_x = notes_result.max()
                std = np.std(notes_result)
                z_score = (my_note - average_x) / std

                # İstatistikleri ekrana yazdırma
                st.subheader("Genel Bilgiler")
                st.write(f"Katilimci Sayısı: {len(notes_result)}")
                st.write(f"En Düşük Not: {min_x:.2f}")
                st.write(f"En Yüksek Not: {max_x:.2f}")
                st.write(f"Ortalama Not: {average_x:.2f}")
                st.write(f"Standart Sapma: {std:.2f}")
                st.write(f"Z-Skoru: {z_score:.2f}")

                # Grafik oluşturma
                st.subheader("Not Dağılım Grafiği")
                unique_values, counts = np.unique(notes_result, return_counts=True)
                plt.figure(figsize=(10, 6))
                bars = plt.bar(unique_values, counts, width=0.3)
                plt.axvline(x=average_x, color='red', linestyle='--')
                plt.text(average_x + 1.5, max(counts), 'Ortalama Not', color='red', rotation=0, ha='center', va='bottom')

                if my_note in unique_values:
                    plt.text(my_note, counts[unique_values == my_note][0], 'Benim\nNotum', color='green', rotation=0, ha='center', va='bottom')

                for bar in bars:
                    if bar.get_x() <= my_note < bar.get_x() + bar.get_width():
                        bar.set_color('green')

                plt.title(f'{lecture_name} Not Sayıları Grafiği')
                plt.xlabel('Notlar')
                plt.ylabel('Adet')
                plt.xticks(range(0, int(perfect_score), note_s_axis_diff), rotation=90)
                plt.yticks(range(0, max(counts), amount_s_axis_diff), rotation=0)

                # Grafik bilgileri
                info_text = (
                    f"Katilimci sayısı: {len(notes_result)}\n"
                    f"En düşük not: {min_x:.2f}\n"
                    f"En yüksek not: {max_x:.2f}\n"
                    f"Benim notum: {my_note:.2f}\n"
                    f"Ortalama not: {average_x:.2f}\n"
                    f"Standart sapma: {std:.2f}\n"
                    f"Z-skoru: {z_score:.2f}"
                )
                plt.text(
                    1.05 * max(unique_values), 0.8 * max(counts),
                    info_text,
                    fontsize=10,
                    color="black",
                    ha="left",
                    va="top",
                    bbox=dict(boxstyle="round,pad=0.3", edgecolor="blue", facecolor="lightgrey")
                )
                plt.subplots_adjust(left=0.055, bottom=0.065, right=0.90, top=0.962, wspace=0.2, hspace=0.2)
                
                # Sağ alt köşeye "Generated by Note Analyzer" metni ekle
                plt.text(
                    0.99, -0.15,  # Sağ alt köşeye konumlandır
                    "Generated by Note Analyzer at HuggingFace aliicemill/NoteAnalyzer space",
                    fontsize=8,
                    color="gray",
                    ha="right",
                    va="top",
                    transform=plt.gca().transAxes  # Koordinatları grafiğe göre ayarla
                )

                # Grafik gösterimi
                st.pyplot(plt)

                # Grafik indirme bağlantısı
                buf = BytesIO()
                plt.savefig(buf, format="png")
                buf.seek(0)
                st.download_button(
                    label="Grafiği İndir",
                    data=buf,
                    file_name="not_dagilimi.png",
                    mime="image/png"
                )

            except Exception as e:
                st.error(f"Hata: {e}")

    # Web sayfasının altına isim ve tarih
    st.markdown("---")
    st.write("Developed by: Ali Cemil Özdemir")
    st.write("Date: 01.12.2024")
    st.write("For feedback and suggestions, you can contact me at [email protected]")

    # Grafiklerin sağ alt köşesine yazı ekleme
    st.markdown("""
        <p style="position:absolute; bottom:0px; right:0px; font-size: 12px; color: gray;">
            Created with Note Analyzer
        </p>
        """, unsafe_allow_html=True)


def run_arabic():
    # العنوان
    st.title("تطبيق محلل الدرجات باستخدام Streamlit")

    # حالة عرض الصور
    if "show_images" not in st.session_state:
        st.session_state.show_images = True  # الافتراضي: يتم عرض الصور

    # منطقة إدخال البيانات في الشريط الجانبي
    st.sidebar.header("حقول الإدخال")

    # اختيار رفع ملف أو إدخال النصوص يدويًا
    input_method = st.sidebar.radio(
        "كيف ستقدم الدرجات؟",
        options=["رفع ملف", "نسخ ولصق"]
    )

    uploaded_file = None
    text_input = None

    if input_method == "رفع ملف":
        uploaded_file = st.sidebar.file_uploader("قم برفع ملف الدرجات (TXT)", type=["txt"])
    elif input_method == "نسخ ولصق":
        text_input = st.sidebar.text_area("قم بلصق الدرجات هنا", height=200)

    # المعلمات الأخرى
    lecture_name = st.sidebar.text_input("اسم المادة", value="اسم المادة")
    perfect_score = st.sidebar.number_input("الدرجة الكاملة", value=100, step=1)
    my_note = st.sidebar.number_input("درجتي", value=0.0, step=0.1)
    note_s_axis_diff = st.sidebar.number_input("حجم خطوات المحور السيني للدرجات", value=5, step=1)
    amount_s_axis_diff = st.sidebar.number_input("حجم خطوات المحور الصادي للتكرار", value=1, step=1)
    first_step = st.sidebar.number_input("الخطوة الأولى", value=0, step=1)
    increase_amount = st.sidebar.number_input("مقدار الزيادة", value=1, step=1)

    if st.sidebar.button("تشغيل التحليل"):
        # إخفاء الصور عند النقر على الزر
        st.session_state.show_images = False

    # عرض الصور فقط إذا كانت show_images صحيحة
    if st.session_state.show_images:
        st.subheader("كيفية عمل التطبيق")

        # قائمة بأسماء ملفات الصور بالترتيب
        image_files = ["arabic/a.png", "arabic/b.png", "arabic/c.png", "arabic/d.png"]

        # عرض الصور واحدة تحت الأخرى
        for image_file in image_files:
            st.image(image_file, use_container_width=True)

    # تحميل ومعالجة الدرجات (يعمل فقط إذا تم النقر على الزر)
    if not st.session_state.show_images:
        if input_method == "رفع ملف" and uploaded_file is None:
            st.error("يرجى رفع ملف!")
        elif input_method == "نسخ ولصق" and not text_input:
            st.error("يرجى لصق الدرجات في مربع النص!")
        else:
            try:
                # قراءة المحتوى من الملف أو مربع النص
                if uploaded_file:
                    content = uploaded_file.read().decode("utf-8")
                elif text_input:
                    content = text_input

                # معالجة البيانات
                content = content.strip()
                result = re.split(r'[ \n]+', content)

                # تنظيف وتصنيف البيانات
                notes_result = [x.strip() for x in result[first_step::increase_amount] if x.strip() != '∅' and x.strip() != "NA"]
                notes_result = list(map(lambda x: float(x), notes_result))
                notes_result = np.array(notes_result)

                # الإحصائيات
                average_x = np.average(notes_result)
                min_x = notes_result.min()
                max_x = notes_result.max()
                std = np.std(notes_result)
                z_score = (my_note - average_x) / std

                # عرض الإحصائيات
                st.subheader("المعلومات العامة")
                st.write(f"عدد المشاركين: {len(notes_result)}")
                st.write(f"أقل درجة: {min_x:.2f}")
                st.write(f"أعلى درجة: {max_x:.2f}")
                st.write(f"متوسط الدرجات: {average_x:.2f}")
                st.write(f"الانحراف المعياري: {std:.2f}")
                st.write(f"درجة Z: {z_score:.2f}")

                # إنشاء الرسم البياني
                st.subheader("رسم توزيع الدرجات")
                unique_values, counts = np.unique(notes_result, return_counts=True)
                plt.figure(figsize=(10, 6))
                bars = plt.bar(unique_values, counts, width=0.3)
                plt.axvline(x=average_x, color='red', linestyle='--')
                plt.text(average_x + 1.5, max(counts), 'متوسط الدرجات', color='red', rotation=0, ha='center', va='bottom')

                if my_note in unique_values:
                    plt.text(my_note, counts[unique_values == my_note][0], 'درجتي', color='green', rotation=0, ha='center', va='bottom')

                for bar in bars:
                    if bar.get_x() <= my_note < bar.get_x() + bar.get_width():
                        bar.set_color('green')

                plt.title(f'رسم توزيع الدرجات لمادة {lecture_name}')
                plt.xlabel('الدرجات')
                plt.ylabel('التكرار')
                plt.xticks(range(0, int(perfect_score), note_s_axis_diff), rotation=90)
                plt.yticks(range(0, max(counts), amount_s_axis_diff), rotation=0)

                # إضافة معلومات إلى الرسم البياني
                info_text = (
                    f"عدد المشاركين: {len(notes_result)}\n"
                    f"أقل درجة: {min_x:.2f}\n"
                    f"أعلى درجة: {max_x:.2f}\n"
                    f"درجتي: {my_note:.2f}\n"
                    f"متوسط الدرجات: {average_x:.2f}\n"
                    f"الانحراف المعياري: {std:.2f}\n"
                    f"درجة Z: {z_score:.2f}"
                )
                plt.text(
                    1.05 * max(unique_values), 0.8 * max(counts),
                    info_text,
                    fontsize=10,
                    color="black",
                    ha="left",
                    va="top",
                    bbox=dict(boxstyle="round,pad=0.3", edgecolor="blue", facecolor="lightgrey")
                )
                plt.subplots_adjust(left=0.055, bottom=0.065, right=0.90, top=0.962, wspace=0.2, hspace=0.2)
                # Sağ alt köşeye "Generated by Note Analyzer" metni ekle
                plt.text(
                    0.99, -0.15,  # Sağ alt köşeye konumlandır
                    "Generated by Note Analyzer at HuggingFace aliicemill/NoteAnalyzer space",
                    fontsize=8,
                    color="gray",
                    ha="right",
                    va="top",
                    transform=plt.gca().transAxes  # Koordinatları grafiğe göre ayarla
                )
                # عرض الرسم البياني
                st.pyplot(plt)

                # زر لتحميل الرسم البياني
                buf = BytesIO()
                plt.savefig(buf, format="png")
                buf.seek(0)
                st.download_button(
                    label="تحميل الرسم البياني",
                    data=buf,
                    file_name="score_distribution.png",
                    mime="image/png"
                )

            except Exception as e:
                st.error(f"خطأ: {e}")

    # التذييل
    st.markdown("---")
    st.write("تم التطوير بواسطة: علي جميل أوزدمير")
    st.write("التاريخ: 01.12.2024")
    st.write("للتعليقات والاقتراحات، يمكنك التواصل عبر: [email protected]")

    # إضافة ملاحظة أسفل الزاوية اليمنى
    st.markdown("""
        <p style="position:absolute; bottom:0px; right:0px; font-size: 12px; color: gray;">
            تم الإنشاء باستخدام محلل الدرجات
        </p>
        """, unsafe_allow_html=True)


def run_english():
    # Title
    st.title("Note Analyzer Streamlit Application")

    # Image display state
    if "show_images" not in st.session_state:
        st.session_state.show_images = True  # Default: images are shown

    # Sidebar input area
    st.sidebar.header("Input Fields")

    # File upload or text input selection
    input_method = st.sidebar.radio(
        "How will you provide the notes?",
        options=["Upload File", "Copy-Paste"]
    )

    uploaded_file = None
    text_input = None

    if input_method == "Upload File":
        uploaded_file = st.sidebar.file_uploader("Upload the Notes File (TXT)", type=["txt"])
    elif input_method == "Copy-Paste":
        text_input = st.sidebar.text_area("Paste the Notes Here", height=200)

    # Other parameters
    lecture_name = st.sidebar.text_input("Course Name", value="Course Name")
    perfect_score = st.sidebar.number_input("Maximum Exam Score", value=100, step=1)
    my_note = st.sidebar.number_input("My Score", value=0.0, step=0.1)
    note_s_axis_diff = st.sidebar.number_input("Score X-Axis Step Size", value=5, step=1)
    amount_s_axis_diff = st.sidebar.number_input("Frequency Y-Axis Step Size", value=1, step=1)
    first_step = st.sidebar.number_input("First Step", value=0, step=1)
    increase_amount = st.sidebar.number_input("Step Increase", value=1, step=1)

    if st.sidebar.button("Run Analysis"):
        # Hide images when the button is clicked
        st.session_state.show_images = False

    # Show images only if show_images is True
    if st.session_state.show_images:
        st.subheader("How the Application Works")

        # List the image filenames in order
        image_files = ["english/a.png", "english/b.png", "english/c.png", "english/d.png"]

        # Display images one below the other
        for image_file in image_files:
            st.image(image_file, use_container_width=True)

    # Load and process notes (Only works if the button is clicked)
    if not st.session_state.show_images:
        if input_method == "Upload File" and uploaded_file is None:
            st.error("Please upload a file!")
        elif input_method == "Copy-Paste" and not text_input:
            st.error("Please paste the notes into the text area!")
        else:
            try:
                # Read content from file or text area
                if uploaded_file:
                    content = uploaded_file.read().decode("utf-8")
                elif text_input:
                    content = text_input

                # Process the data
                content = content.strip()
                result = re.split(r'[ \n]+', content)

                # Clean and filter the data
                notes_result = [x.strip() for x in result[first_step::increase_amount] if x.strip() != '∅' and x.strip() != "NA"]
                notes_result = list(map(lambda x: float(x), notes_result))
                notes_result = np.array(notes_result)

                # Statistics
                average_x = np.average(notes_result)
                min_x = notes_result.min()
                max_x = notes_result.max()
                std = np.std(notes_result)
                z_score = (my_note - average_x) / std

                # Display statistics
                st.subheader("General Information")
                st.write(f"Number of Participants: {len(notes_result)}")
                st.write(f"Lowest Score: {min_x:.2f}")
                st.write(f"Highest Score: {max_x:.2f}")
                st.write(f"Average Score: {average_x:.2f}")
                st.write(f"Standard Deviation: {std:.2f}")
                st.write(f"Z-Score: {z_score:.2f}")

                # Create plot
                st.subheader("Score Distribution Graph")
                unique_values, counts = np.unique(notes_result, return_counts=True)
                plt.figure(figsize=(10, 6))
                bars = plt.bar(unique_values, counts, width=0.3)
                plt.axvline(x=average_x, color='red', linestyle='--')
                plt.text(average_x + 1.5, max(counts), 'Average Score', color='red', rotation=0, ha='center', va='bottom')

                if my_note in unique_values:
                    plt.text(my_note, counts[unique_values == my_note][0], 'My\nScore', color='green', rotation=0, ha='center', va='bottom')

                for bar in bars:
                    if bar.get_x() <= my_note < bar.get_x() + bar.get_width():
                        bar.set_color('green')

                plt.title(f'{lecture_name} Score Distribution')
                plt.xlabel('Scores')
                plt.ylabel('Count')
                plt.xticks(range(0, int(perfect_score), note_s_axis_diff), rotation=90)
                plt.yticks(range(0, max(counts), amount_s_axis_diff), rotation=0)

                # Add graph information
                info_text = (
                    f"Number of participants: {len(notes_result)}\n"
                    f"Lowest score: {min_x:.2f}\n"
                    f"Highest score: {max_x:.2f}\n"
                    f"My score: {my_note:.2f}\n"
                    f"Average score: {average_x:.2f}\n"
                    f"Standard deviation: {std:.2f}\n"
                    f"Z-score: {z_score:.2f}"
                )
                plt.text(
                    1.05 * max(unique_values), 0.8 * max(counts),
                    info_text,
                    fontsize=10,
                    color="black",
                    ha="left",
                    va="top",
                    bbox=dict(boxstyle="round,pad=0.3", edgecolor="blue", facecolor="lightgrey")
                )
                plt.subplots_adjust(left=0.055, bottom=0.065, right=0.90, top=0.962, wspace=0.2, hspace=0.2)
                # Sağ alt köşeye "Generated by Note Analyzer" metni ekle
                plt.text(
                    0.99, -0.15,  # Sağ alt köşeye konumlandır
                    "Generated by Note Analyzer at HuggingFace aliicemill/NoteAnalyzer space",
                    fontsize=8,
                    color="gray",
                    ha="right",
                    va="top",
                    transform=plt.gca().transAxes  # Koordinatları grafiğe göre ayarla
                )

                # Display the plot
                st.pyplot(plt)

                # Download button for the plot
                buf = BytesIO()
                plt.savefig(buf, format="png")
                buf.seek(0)
                st.download_button(
                    label="Download Graph",
                    data=buf,
                    file_name="score_distribution.png",
                    mime="image/png"
                )

            except Exception as e:
                st.error(f"Error: {e}")

    # Footer
    st.markdown("---")
    st.write("Developed by: Ali Cemil Özdemir")
    st.write("Date: 01.12.2024")
    st.write("For feedback and suggestions, you can contact me at [email protected]")

    # Add a note at the bottom right corner of the page
    st.markdown("""
        <p style="position:absolute; bottom:0px; right:0px; font-size: 12px; color: gray;">
            Created with Note Analyzer
        </p>
        """, unsafe_allow_html=True)

# Session State'i başlat
if "language" not in st.session_state:
    st.session_state.language = None

# Dil seçimi ekranı
if st.session_state.language is None:
    st.title("Select language / Dili seçin / اختر اللغة")
    col1, col2, col3 = st.columns(3)

    with col1:
        if st.button("Türkçe"):
            st.session_state.language = "turkish"
    with col2:
        if st.button("English"):
            st.session_state.language = "english"
    with col3:
        if st.button("عربي"):
            st.session_state.language = "arabic"

# Seçilen dilin programını çalıştır
else:
    if st.session_state.language == "turkish":
        run_turkish()
    elif st.session_state.language == "english":
        run_english()
    elif st.session_state.language == "arabic":
        run_arabic()