drmurataltun commited on
Commit
d9df0dd
·
verified ·
1 Parent(s): 1c81493

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +39 -35
app.py CHANGED
@@ -1,35 +1,39 @@
1
- import streamlit as st
2
- import pandas as pd
3
-
4
- st.title("Kişisel Bilgi Formu")
5
-
6
- # Ad ve Soyad
7
- name = st.text_input("Adınız ve Soyadınız (küçük harf):", max_chars=50)
8
-
9
- # Doğum Yılı
10
- birth_year = st.number_input("Doğum Yılınız:", min_value=1900, max_value=2023, step=1)
11
-
12
- # E-posta Adresi
13
- email = st.text_input("E-posta Adresiniz:", type="email")
14
-
15
- # Özgeçmiş Dosyası
16
- resume = st.file_uploader("Özgeçmiş Dosyanız (maks. 3 MB):", type=["pdf", "doc", "docx"])
17
-
18
- # Cinsiyet
19
- gender = st.selectbox("Cinsiyetiniz:", ["Erkek", "Kadın", "Diğer"])
20
-
21
- # Hakkında
22
- about = st.text_area("Kendiniz Hakkında (maks. 500 karakter):", max_chars=500)
23
-
24
- if st.button("Gönder"):
25
- data = {
26
- "Ad ve Soyad": name,
27
- "Doğum Yılı": birth_year,
28
- "E-posta": email,
29
- "Cinsiyet": gender,
30
- "Hakkında": about
31
- }
32
- df = pd.DataFrame([data])
33
- df.to_csv("katilimformu.csv", index=False)
34
- st.success("Formu başarıyla gönderdiz!")
35
- st.write(df)
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import re
4
+
5
+ def is_valid_email(email):
6
+ # E-posta adresinin geçerli formatta olup olmadığını kontrol eden fonksiyon
7
+ email_regex = r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b'
8
+ return bool(re.fullmatch(email_regex, email))
9
+
10
+ st.title("Kişisel Bilgi Formu")
11
+
12
+ # Ad ve Soyad
13
+ name = st.text_input("Adınız ve Soyadınız (küçük harf):", max_chars=50)
14
+
15
+ # Doğum Yılı
16
+ birth_year = st.number_input("Doğum Yılınız:", min_value=1900, max_value=2023, step=1)
17
+
18
+ # E-posta Adresi
19
+ email = st.text_input("E-posta Adresiniz:")
20
+
21
+ # Formu gönder
22
+ if st.button("Gönder"):
23
+ if is_valid_email(email):
24
+ # Önceki kayıtları yükle
25
+ try:
26
+ df = pd.read_csv("katilimformu.csv")
27
+ except FileNotFoundError:
28
+ df = pd.DataFrame(columns=["Ad ve Soyad", "Doğum Yılı", "E-posta"])
29
+
30
+ # Yeni veriyi dataframe'e ekle
31
+ new_data = {"Ad ve Soyad": name, "Doğum Yılı": birth_year, "E-posta": email}
32
+ df = df.append(new_data, ignore_index=True)
33
+
34
+ # Dataframe'i CSV dosyasına kaydet
35
+ df.to_csv("katilimformu.csv", index=False)
36
+ st.success("Formu başarıyla gönderdiz!")
37
+ st.write(df)
38
+ else:
39
+ st.error("Lütfen geçerli bir e-posta adresi girin.")