aliicemill commited on
Commit
c7f7838
·
verified ·
1 Parent(s): 67e50f2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +43 -68
app.py CHANGED
@@ -4,78 +4,53 @@ import numpy as np
4
  import matplotlib.pyplot as plt
5
  from io import BytesIO
6
 
7
- # Sayfanın üst kısmında sabit kalması için CSS stilini ekle
8
- st.markdown("""
9
- <style>
10
- .stApp {
11
- padding-top: 150px;
12
- }
13
- .sidebar .sidebar-content {
14
- position: fixed;
15
- top: 0;
16
- left: 0;
17
- z-index: 100;
18
- width: 100%;
19
- height: 100%;
20
- background-color: white;
21
- }
22
- .stSidebar {
23
- position: fixed;
24
- top: 0;
25
- left: 0;
26
- z-index: 1;
27
- width: 250px;
28
- height: 100vh;
29
- overflow-y: auto;
30
- }
31
- .stMain {
32
- margin-left: 270px;
33
- padding: 20px;
34
- }
35
- </style>
36
- """, unsafe_allow_html=True)
37
-
38
  # Başlık
39
  st.title("Note Analyzer Streamlit Uygulaması")
40
 
41
- # Açıklama Resimleri
42
- st.subheader("Uygulamanın Çalışma Prensibi")
43
-
44
- # Resimlerin dosya isimlerini sırayla listele
45
- image_files = ["a.png", "b.png", "c.png", "d.png", "e.png", "f.png", "g.png"]
46
-
47
- # Resimleri alt alta ekle
48
- for image_file in image_files:
49
- st.image(image_file, use_container_width=True) # Yeni parametre kullanıldı
50
-
51
- # Kullanıcıdan veri alma (Sidebar sabit kalıyor)
52
- st.sidebar.header("Girdi Alanları")
53
-
54
- # Dosya yükleme veya metin girişi seçimi
55
- input_method = st.sidebar.radio(
56
- "Notları nasıl gireceksiniz?",
57
- options=["Dosya Yükle", "Kopyala-Yapıştır"]
58
- )
59
-
60
- uploaded_file = None
61
- text_input = None
62
-
63
- if input_method == "Dosya Yükle":
64
- uploaded_file = st.sidebar.file_uploader("Notlar Dosyasını Yükleyin (TXT)", type=["txt"])
65
- elif input_method == "Kopyala-Yapıştır":
66
- text_input = st.sidebar.text_area("Notları Yapıştırın", height=200)
67
-
68
- # Diğer parametreler
69
- lecture_name = st.sidebar.text_input("Ders Adı", value="Ders Adı")
70
- perfect_score = st.sidebar.number_input("Sınav Puanı Üst Limiti", value=100, step=1)
71
- my_note = st.sidebar.number_input("Benim Notum", value=0.0, step=0.1)
72
- note_s_axis_diff = st.sidebar.number_input("Notlar X Ekseni Ortak Farkı", value=5, step=1)
73
- amount_s_axis_diff = st.sidebar.number_input("Miktar Y Ekseni Ortak Farkı", value=1, step=1)
74
- first_step = st.sidebar.number_input("İlk Adım", value=0, step=1)
75
- increase_amount = st.sidebar.number_input("Artış Miktarı", value=1, step=1)
 
 
 
 
 
 
 
 
76
 
77
- if st.sidebar.button("Analizi Çalıştır"):
78
- # Notları yükleme ve işleme
79
  if input_method == "Dosya Yükle" and uploaded_file is None:
80
  st.error("Lütfen bir dosya yükleyin!")
81
  elif input_method == "Kopyala-Yapıştır" and not text_input:
 
4
  import matplotlib.pyplot as plt
5
  from io import BytesIO
6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  # Başlık
8
  st.title("Note Analyzer Streamlit Uygulaması")
9
 
10
+ # Durum değişkeni (başlangıçta False)
11
+ if "analysis_started" not in st.session_state:
12
+ st.session_state.analysis_started = False
13
+
14
+ # "Uygulamanın Çalışma Prensibi" sadece analiz başlamadan önce gösterilir
15
+ if not st.session_state.analysis_started:
16
+ st.subheader("Uygulamanın Çalışma Prensibi")
17
+
18
+ # Resimlerin dosya isimlerini sırayla listele
19
+ image_files = ["a.png", "b.png", "c.png", "d.png", "e.png", "f.png", "g.png"]
20
+
21
+ # Resimleri alt alta ekle
22
+ for image_file in image_files:
23
+ st.image(image_file, use_container_width=True)
24
+
25
+ # Kullanıcıdan veri alma (Expander içinde sabit giriş alanları)
26
+ with st.expander("Girdi Alanları", expanded=True):
27
+ # Dosya yükleme veya metin girişi seçimi
28
+ input_method = st.radio(
29
+ "Notları nasıl gireceksiniz?",
30
+ options=["Dosya Yükle", "Kopyala-Yapıştır"]
31
+ )
32
+
33
+ uploaded_file = None
34
+ text_input = None
35
+
36
+ if input_method == "Dosya Yükle":
37
+ uploaded_file = st.file_uploader("Notlar Dosyasını Yükleyin (TXT)", type=["txt"])
38
+ elif input_method == "Kopyala-Yapıştır":
39
+ text_input = st.text_area("Notları Yapıştırın", height=200)
40
+
41
+ # Diğer parametreler
42
+ lecture_name = st.text_input("Ders Adı", value="Ders Adı")
43
+ perfect_score = st.number_input("Sınav Puanı Üst Limiti", value=100, step=1)
44
+ my_note = st.number_input("Benim Notum", value=0.0, step=0.1)
45
+ note_s_axis_diff = st.number_input("Notlar X Ekseni Ortak Farkı", value=5, step=1)
46
+ amount_s_axis_diff = st.number_input("Miktar Y Ekseni Ortak Farkı", value=1, step=1)
47
+ first_step = st.number_input("İlk Adım", value=0, step=1)
48
+ increase_amount = st.number_input("Artış Miktarı", value=1, step=1)
49
+
50
+ # Analiz butonuna basıldığında durum değişkenini True yapar ve çıktıları gösterir
51
+ if st.button("Analizi Çalıştır"):
52
+ st.session_state.analysis_started = True
53
 
 
 
54
  if input_method == "Dosya Yükle" and uploaded_file is None:
55
  st.error("Lütfen bir dosya yükleyin!")
56
  elif input_method == "Kopyala-Yapıştır" and not text_input: