aliicemill commited on
Commit
1eeac42
·
verified ·
1 Parent(s): a020cc3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -47
app.py CHANGED
@@ -3,6 +3,7 @@ import re
3
  import numpy as np
4
  import matplotlib.pyplot as plt
5
  from io import BytesIO
 
6
 
7
  def run_turkish():
8
  # Başlık
@@ -14,19 +15,7 @@ def run_turkish():
14
 
15
  # Kullanıcıdan veri alma (Sidebar sabit kalıyor)
16
  st.sidebar.header("Girdi Alanları")
17
-
18
- # Dosya yükleme veya metin girişi seçimi
19
- """input_method = st.sidebar.radio(
20
- "Notları nasıl gireceksiniz?",
21
- options=["Dosya Yükle", "Kopyala-Yapıştır"]
22
- )
23
-
24
- uploaded_file = None
25
- text_input = None
26
-
27
- if input_method == "Dosya Yükle":
28
- uploaded_file = st.sidebar.file_uploader("Notlar Dosyasını Yükleyin (TXT)", type=["txt"])
29
- elif input_method == "Kopyala-Yapıştır":"""
30
  text_input = st.sidebar.text_area("Notları Yapıştırın", height=200)
31
 
32
  # Diğer parametreler
@@ -44,15 +33,24 @@ def run_turkish():
44
 
45
  # Resimler yalnızca show_images True ise gösterilir
46
  if st.session_state.show_images:
47
- st.subheader("Uygulamanın Çalışma Prensibi(Bilgisayar kullanımı tavsiye edilir)")
48
-
49
- # Resimlerin dosya isimlerini sırayla listele
50
- image_files = ["turkish/a.png", "turkish/b.png", "turkish/c.png", "turkish/d.png"]
51
-
52
- # Resimleri alt alta ekle
53
- for image_file in image_files:
54
- st.image(image_file, use_container_width=True)
55
-
 
 
 
 
 
 
 
 
 
56
  # Notları yükleme ve işleme işlemleri (Butona basıldıysa çalışır)
57
  if not st.session_state.show_images:
58
  if input_method == "Dosya Yükle" and uploaded_file is None:
@@ -190,18 +188,7 @@ def run_arabic():
190
  st.sidebar.header("حقول الإدخال")
191
 
192
  # اختيار رفع ملف أو إدخال النصوص يدويًا
193
- input_method = st.sidebar.radio(
194
- "كيف ستقدم الدرجات؟",
195
- options=["رفع ملف", "نسخ ولصق"]
196
- )
197
-
198
- uploaded_file = None
199
- text_input = None
200
-
201
- if input_method == "رفع ملف":
202
- uploaded_file = st.sidebar.file_uploader("قم برفع ملف الدرجات (TXT)", type=["txt"])
203
- elif input_method == "نسخ ولصق":
204
- text_input = st.sidebar.text_area("قم بلصق الدرجات هنا", height=200)
205
 
206
  # المعلمات الأخرى
207
  lecture_name = st.sidebar.text_input("اسم المادة", value="اسم المادة")
@@ -362,19 +349,7 @@ def run_english():
362
  # Sidebar input area
363
  st.sidebar.header("Input Fields")
364
 
365
- # File upload or text input selection
366
- input_method = st.sidebar.radio(
367
- "How will you provide the notes?",
368
- options=["Upload File", "Copy-Paste"]
369
- )
370
-
371
- uploaded_file = None
372
- text_input = None
373
-
374
- if input_method == "Upload File":
375
- uploaded_file = st.sidebar.file_uploader("Upload the Notes File (TXT)", type=["txt"])
376
- elif input_method == "Copy-Paste":
377
- text_input = st.sidebar.text_area("Paste the Notes Here", height=200)
378
 
379
  # Other parameters
380
  lecture_name = st.sidebar.text_input("Course Name", value="Course Name")
 
3
  import numpy as np
4
  import matplotlib.pyplot as plt
5
  from io import BytesIO
6
+ from huggingface_hub import hf_hub_download
7
 
8
  def run_turkish():
9
  # Başlık
 
15
 
16
  # Kullanıcıdan veri alma (Sidebar sabit kalıyor)
17
  st.sidebar.header("Girdi Alanları")
18
+
 
 
 
 
 
 
 
 
 
 
 
 
19
  text_input = st.sidebar.text_area("Notları Yapıştırın", height=200)
20
 
21
  # Diğer parametreler
 
33
 
34
  # Resimler yalnızca show_images True ise gösterilir
35
  if st.session_state.show_images:
36
+ # HuggingFace'ten dosya indirme
37
+ repo_id = "NoteAnalyzer/turkish" # HuggingFace repo adı
38
+ filename = "NoteAnalyzerTurkish.pdf" # İndirilecek dosyanın adı
39
+
40
+ # Dosyayı indirin
41
+ pdf_path = hf_hub_download(repo_id=repo_id, filename=filename)
42
+
43
+ # Streamlit uygulaması
44
+ st.title("NASIL KULLANILIR: ")
45
+
46
+ # PDF dosyasını iframe ile göster
47
+ with open(pdf_path, "rb") as pdf_file:
48
+ pdf_data = pdf_file.read()
49
+
50
+ st.download_button("PDF İndir", data=pdf_data, file_name="NoteAnalyzerTurkish.pdf")
51
+ st.markdown(f'<iframe src="data:application/pdf;base64,{pdf_data.hex()}" width="700" height="500"></iframe>', unsafe_allow_html=True)
52
+
53
+ #akldnaslkdnmllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
54
  # Notları yükleme ve işleme işlemleri (Butona basıldıysa çalışır)
55
  if not st.session_state.show_images:
56
  if input_method == "Dosya Yükle" and uploaded_file is None:
 
188
  st.sidebar.header("حقول الإدخال")
189
 
190
  # اختيار رفع ملف أو إدخال النصوص يدويًا
191
+ text_input = st.sidebar.text_area("قم بلصق الدرجات هنا", height=200)
 
 
 
 
 
 
 
 
 
 
 
192
 
193
  # المعلمات الأخرى
194
  lecture_name = st.sidebar.text_input("اسم المادة", value="اسم المادة")
 
349
  # Sidebar input area
350
  st.sidebar.header("Input Fields")
351
 
352
+ text_input = st.sidebar.text_area("Paste the Notes Here", height=200)
 
 
 
 
 
 
 
 
 
 
 
 
353
 
354
  # Other parameters
355
  lecture_name = st.sidebar.text_input("Course Name", value="Course Name")