Spaces:
Runtime error
Runtime error
Commit
·
712d61e
1
Parent(s):
97b3ea8
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
- data +1 -1
- functions.py +1 -10
- screen/__pycache__/screen_scan.cpython-310.pyc +0 -0
- screen/screen_scan.py +52 -27
__pycache__/data_func.cpython-310.pyc
CHANGED
|
Binary files a/__pycache__/data_func.cpython-310.pyc and b/__pycache__/data_func.cpython-310.pyc differ
|
|
|
__pycache__/functions.cpython-310.pyc
CHANGED
|
Binary files a/__pycache__/functions.cpython-310.pyc and b/__pycache__/functions.cpython-310.pyc differ
|
|
|
__pycache__/optic1.cpython-310.pyc
CHANGED
|
Binary files a/__pycache__/optic1.cpython-310.pyc and b/__pycache__/optic1.cpython-310.pyc differ
|
|
|
data
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
Subproject commit
|
|
|
|
| 1 |
+
Subproject commit b733259fe70abefb6c892ca9617793f81ab0b2dd
|
functions.py
CHANGED
|
@@ -84,16 +84,7 @@ def grading(answers,num_questions,myAnswers):
|
|
| 84 |
else:
|
| 85 |
grading.append(0)
|
| 86 |
wrong_ans.append(x+1)
|
| 87 |
-
|
| 88 |
-
wrong_ans.append("A")
|
| 89 |
-
if myAnswers[x]== 2:
|
| 90 |
-
wrong_ans.append("B")
|
| 91 |
-
if myAnswers[x]== 3:
|
| 92 |
-
wrong_ans.append("C")
|
| 93 |
-
if myAnswers[x]== 4:
|
| 94 |
-
wrong_ans.append("D")
|
| 95 |
-
if myAnswers[x]== 5:
|
| 96 |
-
wrong_ans.append("E")
|
| 97 |
|
| 98 |
score = (sum(grading)/num_questions)*100
|
| 99 |
return score ,wrong_ans
|
|
|
|
| 84 |
else:
|
| 85 |
grading.append(0)
|
| 86 |
wrong_ans.append(x+1)
|
| 87 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
|
| 89 |
score = (sum(grading)/num_questions)*100
|
| 90 |
return score ,wrong_ans
|
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_scan.py
CHANGED
|
@@ -11,7 +11,6 @@ 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(
|
|
@@ -27,12 +26,15 @@ def pull_read(DATASET_REPO_URL,HF_TOKEN,DATA_FILE):
|
|
| 27 |
@st.cache
|
| 28 |
def convert_df_to_csv(df):
|
| 29 |
# IMPORTANT: Cache the conversion to prevent computation on every rerun
|
| 30 |
-
return df.to_csv().encode('utf-8')
|
| 31 |
|
| 32 |
def screen_scan_main():
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
exam_code = int(exam_code)
|
| 38 |
teacher_code = str(teacher_code)
|
|
@@ -40,39 +42,62 @@ def screen_scan_main():
|
|
| 40 |
DATA_FILENAME = str(DATA_FILENAME)
|
| 41 |
|
| 42 |
image_file = st.file_uploader(
|
| 43 |
-
"
|
| 44 |
|
| 45 |
|
| 46 |
if image_file != None:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
|
| 48 |
-
|
| 49 |
-
|
|
|
|
| 50 |
DATA_FILE = os.path.join("data", DATA_FILENAME),
|
| 51 |
HF_TOKEN = "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")
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
ans_txt2="cevapanahtari/cevapanahtari_ders2.txt",
|
| 58 |
ans_txt3="cevapanahtari/cevapanahtari_ders3.txt",
|
| 59 |
pathImage=image,save_images=False)
|
| 60 |
-
|
| 61 |
-
image_show(resim_list)
|
| 62 |
-
|
| 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 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
|
| 74 |
-
|
| 75 |
-
file_name='
|
| 76 |
|
| 77 |
#python -m streamlit run app.py
|
| 78 |
if __name__ == '__main__':
|
|
|
|
| 11 |
from huggingface_hub import Repository
|
| 12 |
|
| 13 |
|
|
|
|
| 14 |
def pull_read(DATASET_REPO_URL,HF_TOKEN,DATA_FILE):
|
| 15 |
|
| 16 |
repo = Repository(
|
|
|
|
| 26 |
@st.cache
|
| 27 |
def convert_df_to_csv(df):
|
| 28 |
# IMPORTANT: Cache the conversion to prevent computation on every rerun
|
| 29 |
+
return df.to_csv().encode('utf-8')
|
| 30 |
|
| 31 |
def screen_scan_main():
|
| 32 |
+
|
| 33 |
+
col1,col2 = st.columns(2)
|
| 34 |
+
with col1:
|
| 35 |
+
teacher_code = st.text_input("Ogretmen kodu:",key=12)
|
| 36 |
+
with col2:
|
| 37 |
+
exam_code = st.text_input("Sınav Kodu:",key=13,value=10)
|
| 38 |
|
| 39 |
exam_code = int(exam_code)
|
| 40 |
teacher_code = str(teacher_code)
|
|
|
|
| 42 |
DATA_FILENAME = str(DATA_FILENAME)
|
| 43 |
|
| 44 |
image_file = st.file_uploader(
|
| 45 |
+
"Tarama Yapmak Icin Optigi Yukleyin", type=['jpeg', 'png', 'jpg', 'webp'])
|
| 46 |
|
| 47 |
|
| 48 |
if image_file != None:
|
| 49 |
+
col3,col4 = st.columns(2)
|
| 50 |
+
with col3:
|
| 51 |
+
|
| 52 |
+
if st.button("Tara ve Sonucu Goruntule"):
|
| 53 |
+
repo, repo_df = pull_read(DATASET_REPO_URL = "https://huggingface.co/datasets/mertbozkurt/school_data",
|
| 54 |
+
DATA_FILE = os.path.join("data", DATA_FILENAME),
|
| 55 |
+
HF_TOKEN = "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")
|
| 56 |
+
repo.git_pull()
|
| 57 |
+
image = Image.open(image_file)
|
| 58 |
+
image = np.array(image.convert('RGB'))
|
| 59 |
+
#(ans_txt,pathImage, save_images= True)
|
| 60 |
+
grading, wrong_ans, student_idFix, resim_list =optic1.optic1(ans_txt1="cevapanahtari/cevapanahtari_ders1.txt",
|
| 61 |
+
ans_txt2="cevapanahtari/cevapanahtari_ders2.txt",
|
| 62 |
+
ans_txt3="cevapanahtari/cevapanahtari_ders3.txt",
|
| 63 |
+
pathImage=image,save_images=False)
|
| 64 |
+
|
| 65 |
+
#image_show(resim_list)
|
| 66 |
+
if len(wrong_ans[0]) == 0:
|
| 67 |
+
wrong_ans[0] = " "
|
| 68 |
+
wrong_ans_str = ','.join(wrong_ans[0])
|
| 69 |
+
st.write("Notu:",int(grading[0]))
|
| 70 |
+
st.write("Yanlis Yaptigi sorular:",wrong_ans_str)
|
| 71 |
+
st.write("Ogrenci Numarasi:",student_idFix)
|
| 72 |
|
| 73 |
+
with col4:
|
| 74 |
+
if st.button("Tara ve Sonucu Kaydet"):
|
| 75 |
+
repo, repo_df = pull_read(DATASET_REPO_URL = "https://huggingface.co/datasets/mertbozkurt/school_data",
|
| 76 |
DATA_FILE = os.path.join("data", DATA_FILENAME),
|
| 77 |
HF_TOKEN = "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")
|
| 78 |
+
repo.git_pull()
|
| 79 |
+
image = Image.open(image_file)
|
| 80 |
+
image = np.array(image.convert('RGB'))
|
| 81 |
+
#(ans_txt,pathImage, save_images= True)
|
| 82 |
+
grading, wrong_ans, student_idFix, resim_list =optic1.optic1(ans_txt1="cevapanahtari/cevapanahtari_ders1.txt",
|
| 83 |
ans_txt2="cevapanahtari/cevapanahtari_ders2.txt",
|
| 84 |
ans_txt3="cevapanahtari/cevapanahtari_ders3.txt",
|
| 85 |
pathImage=image,save_images=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
|
| 87 |
+
#image_show(resim_list)
|
| 88 |
+
if len(wrong_ans[0]) == 0:
|
| 89 |
+
wrong_ans[0] = " "
|
| 90 |
+
wrong_ans_str = ','.join(wrong_ans[0])
|
| 91 |
+
new_data = make_new_data(sinav_kodu=exam_code, ogrenci_no=int(student_idFix),
|
| 92 |
+
notu=int(grading[0]),yanlislar=wrong_ans_str)
|
| 93 |
+
|
| 94 |
+
#st.dataframe(new_data)
|
| 95 |
+
updated = update(new_data=new_data,ex_df=repo_df)
|
| 96 |
+
#st.dataframe(updated,use_container_width=True)
|
| 97 |
+
save_and_push(dataFrame=updated,repo=repo,fileName=f"data/{DATA_FILENAME}")
|
| 98 |
|
| 99 |
+
st.download_button(label="Tum verileri indirmek icin tiklayin",data=convert_df_to_csv(updated),
|
| 100 |
+
file_name=f'{teacher_code}.csv',mime='text/csv',)
|
| 101 |
|
| 102 |
#python -m streamlit run app.py
|
| 103 |
if __name__ == '__main__':
|