Spaces:
Runtime error
Runtime error
Commit
·
97b3ea8
1
Parent(s):
e00becb
new update
Browse files- __pycache__/data_func.cpython-310.pyc +0 -0
- __pycache__/functions.cpython-310.pyc +0 -0
- __pycache__/optic1.cpython-310.pyc +0 -0
- analysis_func.py +0 -8
- app.py +3 -50
- data +1 -1
- data_func.py +4 -5
- screen/__pycache__/screen_add_note.cpython-310.pyc +0 -0
- screen/__pycache__/screen_note.cpython-310.pyc +0 -0
- screen/__pycache__/screen_scan.cpython-310.pyc +0 -0
- screen/screen_about.py +0 -5
- screen/screen_analysis.py +0 -17
- screen/screen_note.py +0 -15
- screen/screen_scan.py +35 -11
- style.css +0 -4
__pycache__/data_func.cpython-310.pyc
ADDED
Binary file (1.34 kB). View file
|
|
__pycache__/functions.cpython-310.pyc
ADDED
Binary file (4.64 kB). View file
|
|
__pycache__/optic1.cpython-310.pyc
ADDED
Binary file (2.86 kB). View file
|
|
analysis_func.py
DELETED
@@ -1,8 +0,0 @@
|
|
1 |
-
import pandas as pd
|
2 |
-
import numpy as np
|
3 |
-
|
4 |
-
def read_csv(path):
|
5 |
-
dataFrame = pd.read_csv('temp.csv')
|
6 |
-
return dataFrame
|
7 |
-
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.py
CHANGED
@@ -1,59 +1,12 @@
|
|
1 |
import streamlit as st
|
2 |
-
from screen.screen_add_note import screen_add_main
|
3 |
from screen.screen_scan import screen_scan_main
|
4 |
-
from screen.screen_note import screen_note_main
|
5 |
-
from streamlit_option_menu import option_menu
|
6 |
-
|
7 |
-
def local_css(file_name):
|
8 |
-
with open(file_name) as f:
|
9 |
-
st.markdown(f"<style>{f.read()}</style>", unsafe_allow_html=True)
|
10 |
-
|
11 |
-
local_css("style.css")
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
def streamlit_menu(example=3):
|
16 |
-
|
17 |
-
if example == 3:
|
18 |
-
# 2. horizontal menu with custom style
|
19 |
-
selected = option_menu(
|
20 |
-
menu_title=None, # required
|
21 |
-
options=["Optik Okuma", "Not Girisi", "Not Duzenleme","Analiz"], # required
|
22 |
-
icons=["house", "book", "envelope","envelope"],
|
23 |
-
default_index=0, # optional
|
24 |
-
orientation="horizontal",
|
25 |
-
styles={
|
26 |
-
"container": {"padding": "0!important", "background-color": "#b2d8d8"},
|
27 |
-
"icon": {"color": "orange", "font-size": "0px"},
|
28 |
-
"nav-link": {
|
29 |
-
"font-size": "15px",
|
30 |
-
"text-align": "left",
|
31 |
-
"margin": "0px",
|
32 |
-
"--hover-color": "#eee",
|
33 |
-
},
|
34 |
-
"nav-link-selected": {"background-color": "#008080"},
|
35 |
-
},
|
36 |
-
)
|
37 |
-
return selected
|
38 |
-
|
39 |
-
|
40 |
|
41 |
|
42 |
def main():
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
if selected == "Optik Okuma":
|
48 |
-
screen_scan_main()
|
49 |
-
if selected == "Not Girisi":
|
50 |
-
screen_add_main()
|
51 |
-
if selected == "Not Duzenleme":
|
52 |
-
screen_note_main()
|
53 |
-
if selected == "Analiz":
|
54 |
-
screen_note_main()
|
55 |
|
56 |
-
|
57 |
if __name__ == "__main__":
|
58 |
main()
|
59 |
|
|
|
1 |
import streamlit as st
|
|
|
2 |
from screen.screen_scan import screen_scan_main
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
|
5 |
def main():
|
6 |
+
|
7 |
+
screen_scan_main()
|
8 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
|
|
10 |
if __name__ == "__main__":
|
11 |
main()
|
12 |
|
data
CHANGED
@@ -1 +1 @@
|
|
1 |
-
Subproject commit
|
|
|
1 |
+
Subproject commit 15af2cacd27fc180a93ccc0904359de7b1f16481
|
data_func.py
CHANGED
@@ -19,10 +19,9 @@ def pull_read():
|
|
19 |
|
20 |
return repo, df
|
21 |
|
22 |
-
def make_new_data(
|
23 |
-
yeni_satir = {"
|
24 |
"ogrenci_no": ogrenci_no,
|
25 |
-
"ders_kodu": ders_kodu,
|
26 |
"notu": notu,
|
27 |
"yanlis_sorulari": yanlislar}
|
28 |
new_data = pd.DataFrame([yeni_satir])
|
@@ -32,8 +31,8 @@ def update(new_data, ex_df):
|
|
32 |
updated_df = pd.concat([ex_df, new_data])
|
33 |
return updated_df
|
34 |
|
35 |
-
def save_and_push(dataFrame,repo):
|
36 |
-
dataFrame.to_csv(
|
37 |
commit_url = repo.push_to_hub()
|
38 |
return commit_url
|
39 |
|
|
|
19 |
|
20 |
return repo, df
|
21 |
|
22 |
+
def make_new_data(sinav_kodu,ogrenci_no,notu,yanlislar):
|
23 |
+
yeni_satir = {"sinav_kodu": sinav_kodu,
|
24 |
"ogrenci_no": ogrenci_no,
|
|
|
25 |
"notu": notu,
|
26 |
"yanlis_sorulari": yanlislar}
|
27 |
new_data = pd.DataFrame([yeni_satir])
|
|
|
31 |
updated_df = pd.concat([ex_df, new_data])
|
32 |
return updated_df
|
33 |
|
34 |
+
def save_and_push(dataFrame,repo,fileName):
|
35 |
+
dataFrame.to_csv(fileName,index=False)
|
36 |
commit_url = repo.push_to_hub()
|
37 |
return commit_url
|
38 |
|
screen/__pycache__/screen_add_note.cpython-310.pyc
DELETED
Binary file (1.04 kB)
|
|
screen/__pycache__/screen_note.cpython-310.pyc
DELETED
Binary file (598 Bytes)
|
|
screen/__pycache__/screen_scan.cpython-310.pyc
CHANGED
Binary files a/screen/__pycache__/screen_scan.cpython-310.pyc and b/screen/__pycache__/screen_scan.cpython-310.pyc differ
|
|
screen/screen_about.py
DELETED
@@ -1,5 +0,0 @@
|
|
1 |
-
"""""
|
2 |
-
Ornek Pdfler
|
3 |
-
Nasıl KUllanılmalı gıbı seyler yaz
|
4 |
-
|
5 |
-
"""
|
|
|
|
|
|
|
|
|
|
|
|
screen/screen_analysis.py
DELETED
@@ -1,17 +0,0 @@
|
|
1 |
-
import streamlit as st
|
2 |
-
import pandas as pd
|
3 |
-
import data_func
|
4 |
-
from data_func import DATASET_REPO_URL,DATA_FILENAME,DATA_FILE,HF_TOKEN
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
def screen_analysis_main():
|
9 |
-
#repo, repo_df = data_func.pull_read()
|
10 |
-
#ogrenci_no = st.text_input("Öğrenci No")
|
11 |
-
#filtered_df = repo_df[(repo_df['sinif_no'] == 3) & (repo_df['not'] > 70)]
|
12 |
-
dataFrame = pd.read_csv('db/temp.csv')
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
if __name__ == "__main__":
|
17 |
-
screen_analysis_main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
screen/screen_note.py
DELETED
@@ -1,15 +0,0 @@
|
|
1 |
-
import streamlit as st
|
2 |
-
import pandas as pd
|
3 |
-
import data_func
|
4 |
-
from data_func import DATASET_REPO_URL,DATA_FILENAME,DATA_FILE,HF_TOKEN
|
5 |
-
|
6 |
-
|
7 |
-
def screen_note_main():
|
8 |
-
repo, repo_df = data_func.pull_read()
|
9 |
-
|
10 |
-
st.subheader("Girilen Veriler")
|
11 |
-
st.dataframe(repo_df,use_container_width=True)
|
12 |
-
#filtered_df = repo_df[(repo_df['sinif_no'] == 3) & (repo_df['not'] > 70)]
|
13 |
-
|
14 |
-
if __name__ == "__main__":
|
15 |
-
screen_note_main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
screen/screen_scan.py
CHANGED
@@ -6,7 +6,23 @@ from PIL import Image
|
|
6 |
import optic1
|
7 |
from functions import image_show
|
8 |
import pandas as pd
|
9 |
-
from data_func import make_new_data,update
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
@st.cache
|
12 |
def convert_df_to_csv(df):
|
@@ -15,18 +31,27 @@ def convert_df_to_csv(df):
|
|
15 |
|
16 |
def screen_scan_main():
|
17 |
st.title("Optik Okuma")
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
21 |
image_file = st.file_uploader(
|
22 |
"Upload image for testing", type=['jpeg', 'png', 'jpg', 'webp'])
|
23 |
-
|
24 |
|
25 |
if image_file != None:
|
26 |
-
image = Image.open(image_file)
|
27 |
-
image = np.array(image.convert('RGB'))
|
28 |
|
29 |
if st.button("Process"):
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
#(ans_txt,pathImage, save_images= True)
|
31 |
grading, wrong_ans, student_idFix, resim_list =optic1.optic1(ans_txt1="cevapanahtari/cevapanahtari_ders1.txt",
|
32 |
ans_txt2="cevapanahtari/cevapanahtari_ders2.txt",
|
@@ -38,18 +63,17 @@ def screen_scan_main():
|
|
38 |
st.write("Notu:",grading[0])
|
39 |
st.write("Yanlis Yaptigi sorular:",wrong_ans[0])
|
40 |
st.write("Ogrenci Numarasi:",student_idFix)
|
41 |
-
new_data = make_new_data(
|
42 |
notu=grading[0],yanlislar=wrong_ans[0])
|
43 |
|
44 |
st.dataframe(new_data)
|
45 |
-
updated = update(new_data=new_data,ex_df=
|
46 |
st.dataframe(updated,use_container_width=True)
|
47 |
-
updated
|
48 |
|
49 |
st.download_button(label="Download data as CSV",data=convert_df_to_csv(updated),
|
50 |
file_name='large_df.csv',mime='text/csv',)
|
51 |
|
52 |
-
|
53 |
#python -m streamlit run app.py
|
54 |
if __name__ == '__main__':
|
55 |
screen_scan_main()
|
|
|
6 |
import optic1
|
7 |
from functions import image_show
|
8 |
import pandas as pd
|
9 |
+
from data_func import make_new_data,update,save_and_push
|
10 |
+
import os
|
11 |
+
from huggingface_hub import Repository
|
12 |
+
|
13 |
+
|
14 |
+
|
15 |
+
def pull_read(DATASET_REPO_URL,HF_TOKEN,DATA_FILE):
|
16 |
+
|
17 |
+
repo = Repository(
|
18 |
+
local_dir="data", clone_from=DATASET_REPO_URL, use_auth_token=HF_TOKEN
|
19 |
+
)
|
20 |
+
|
21 |
+
with open(DATA_FILE) as csvfile:
|
22 |
+
df = pd.read_csv(csvfile)
|
23 |
+
df = pd.DataFrame(df)
|
24 |
+
|
25 |
+
return repo, df
|
26 |
|
27 |
@st.cache
|
28 |
def convert_df_to_csv(df):
|
|
|
31 |
|
32 |
def screen_scan_main():
|
33 |
st.title("Optik Okuma")
|
34 |
+
teacher_code = st.text_input("Ogretmen kodu:",key=12)
|
35 |
+
exam_code = st.text_input("Sınav Kodu:",key=13,value=10)
|
36 |
+
|
37 |
+
exam_code = int(exam_code)
|
38 |
+
teacher_code = str(teacher_code)
|
39 |
+
DATA_FILENAME = f"{teacher_code}.csv"
|
40 |
+
DATA_FILENAME = str(DATA_FILENAME)
|
41 |
+
|
42 |
image_file = st.file_uploader(
|
43 |
"Upload image for testing", type=['jpeg', 'png', 'jpg', 'webp'])
|
44 |
+
|
45 |
|
46 |
if image_file != None:
|
|
|
|
|
47 |
|
48 |
if st.button("Process"):
|
49 |
+
repo, repo_df = pull_read(DATASET_REPO_URL = "https://huggingface.co/datasets/mertbozkurt/school_data",
|
50 |
+
DATA_FILE = os.path.join("data", DATA_FILENAME),
|
51 |
+
HF_TOKEN = "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")
|
52 |
+
repo.git_pull()
|
53 |
+
image = Image.open(image_file)
|
54 |
+
image = np.array(image.convert('RGB'))
|
55 |
#(ans_txt,pathImage, save_images= True)
|
56 |
grading, wrong_ans, student_idFix, resim_list =optic1.optic1(ans_txt1="cevapanahtari/cevapanahtari_ders1.txt",
|
57 |
ans_txt2="cevapanahtari/cevapanahtari_ders2.txt",
|
|
|
63 |
st.write("Notu:",grading[0])
|
64 |
st.write("Yanlis Yaptigi sorular:",wrong_ans[0])
|
65 |
st.write("Ogrenci Numarasi:",student_idFix)
|
66 |
+
new_data = make_new_data(sinav_kodu=exam_code, ogrenci_no=int(student_idFix),
|
67 |
notu=grading[0],yanlislar=wrong_ans[0])
|
68 |
|
69 |
st.dataframe(new_data)
|
70 |
+
updated = update(new_data=new_data,ex_df=repo_df)
|
71 |
st.dataframe(updated,use_container_width=True)
|
72 |
+
save_and_push(dataFrame=updated,repo=repo,fileName=f"data/{DATA_FILENAME}")
|
73 |
|
74 |
st.download_button(label="Download data as CSV",data=convert_df_to_csv(updated),
|
75 |
file_name='large_df.csv',mime='text/csv',)
|
76 |
|
|
|
77 |
#python -m streamlit run app.py
|
78 |
if __name__ == '__main__':
|
79 |
screen_scan_main()
|
style.css
DELETED
@@ -1,4 +0,0 @@
|
|
1 |
-
section[data-testid="stSidebar"] div.stButton button {
|
2 |
-
background-color: rgb(95, 197, 228);
|
3 |
-
width: 200px;
|
4 |
-
}
|
|
|
|
|
|
|
|
|
|