Spaces:
Sleeping
Sleeping
Delete app.py
Browse files
app.py
DELETED
|
@@ -1,71 +0,0 @@
|
|
| 1 |
-
import streamlit as st
|
| 2 |
-
import subprocess
|
| 3 |
-
from pathlib import Path
|
| 4 |
-
|
| 5 |
-
# Streamlit başlığı ve açıklaması
|
| 6 |
-
st.title("Note Analyzer Web Uygulaması")
|
| 7 |
-
st.write("Not analizi için gerekli bilgileri girin ve dosyanızı yükleyin!")
|
| 8 |
-
|
| 9 |
-
# Kullanıcı giriş alanları
|
| 10 |
-
address_of_notes = st.file_uploader("Not Dosyasını Yükleyin (txt formatında):", type=["txt"])
|
| 11 |
-
lecture_name = st.text_input("Ders Adı:")
|
| 12 |
-
perfect_score = st.text_input("Sınavınız Kaç Puan Üzerinden:")
|
| 13 |
-
my_note = st.text_input("Benim Notum:")
|
| 14 |
-
note_s_axis_diff = st.text_input("Notlar X Ekseni Ortak Farkı:")
|
| 15 |
-
amount_s_axis_diff = st.text_input("Miktar Y Ekseni Ortak Farkı:")
|
| 16 |
-
first_step = st.text_input("İlk Adım (Sadece notlar varsa 0 yazın):")
|
| 17 |
-
increase_amount = st.text_input("Artış Miktarı (Sadece notlar varsa 1 yazın):")
|
| 18 |
-
|
| 19 |
-
# Analizi çalıştır butonu
|
| 20 |
-
if st.button("Analizi Çalıştır"):
|
| 21 |
-
# Alanların doldurulduğunu kontrol et
|
| 22 |
-
if not all([address_of_notes, lecture_name, perfect_score, my_note, note_s_axis_diff, amount_s_axis_diff, first_step, increase_amount]):
|
| 23 |
-
st.error("Lütfen tüm alanları doldurun!")
|
| 24 |
-
else:
|
| 25 |
-
try:
|
| 26 |
-
# Sayısal değerleri doğrula
|
| 27 |
-
perfect_score = int(perfect_score)
|
| 28 |
-
my_note = float(my_note)
|
| 29 |
-
note_s_axis_diff = int(note_s_axis_diff)
|
| 30 |
-
amount_s_axis_diff = int(amount_s_axis_diff)
|
| 31 |
-
first_step = int(first_step)
|
| 32 |
-
increase_amount = int(increase_amount)
|
| 33 |
-
|
| 34 |
-
# Geçici dosya oluşturma ve kaydetme
|
| 35 |
-
temp_file_path = "/tmp/uploaded_notes.txt"
|
| 36 |
-
with open(temp_file_path, "wb") as f:
|
| 37 |
-
f.write(address_of_notes.read())
|
| 38 |
-
|
| 39 |
-
# NoteAnalyzer.py dosyasını çalıştırma
|
| 40 |
-
output_image_path = "/tmp/analysis_plot.png"
|
| 41 |
-
subprocess.run([
|
| 42 |
-
"python", "note_analyzer.py",
|
| 43 |
-
temp_file_path,
|
| 44 |
-
lecture_name,
|
| 45 |
-
str(perfect_score),
|
| 46 |
-
str(my_note),
|
| 47 |
-
str(note_s_axis_diff),
|
| 48 |
-
str(amount_s_axis_diff),
|
| 49 |
-
str(first_step),
|
| 50 |
-
str(increase_amount)
|
| 51 |
-
], check=True)
|
| 52 |
-
|
| 53 |
-
# Analiz başarı mesajı
|
| 54 |
-
st.success("Analiz başarıyla tamamlandı! Aşağıda grafiği görebilirsiniz.")
|
| 55 |
-
|
| 56 |
-
# Grafiği görüntüleme
|
| 57 |
-
st.image(output_image_path, caption="Not Analizi Grafiği")
|
| 58 |
-
|
| 59 |
-
# Grafiği indirme bağlantısı
|
| 60 |
-
with open(output_image_path, "rb") as img_file:
|
| 61 |
-
st.download_button(
|
| 62 |
-
label="Grafiği İndir",
|
| 63 |
-
data=img_file,
|
| 64 |
-
file_name="analysis_plot.png",
|
| 65 |
-
mime="image/png"
|
| 66 |
-
)
|
| 67 |
-
|
| 68 |
-
except ValueError:
|
| 69 |
-
st.error("Lütfen geçerli sayısal değerler girin!")
|
| 70 |
-
except Exception as e:
|
| 71 |
-
st.error(f"Bir hata oluştu: {e}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|