aliicemill commited on
Commit
2af73be
·
verified ·
1 Parent(s): 801bf84

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -20
app.py CHANGED
@@ -33,31 +33,19 @@ def run_turkish():
33
 
34
  # Resimler yalnızca show_images True ise gösterilir
35
  if st.session_state.show_images:
36
- # Uygulama başlığı
37
- st.title("NoteAnalyzerTurkish.pdf Gösterimi")
38
-
39
  # PDF dosyasının yolu
40
  pdf_path = os.path.join("turkish", "NoteAnalyzerTurkish.pdf")
41
 
42
- # PDF'nin mevcut olup olmadığını kontrol edin
43
- if os.path.exists(pdf_path):
44
- # PDF dosyasını göster
45
- with open(pdf_path, "rb") as pdf_file:
46
- pdf_data = pdf_file.read()
47
 
48
- st.download_button(
49
- label="PDF İndir",
50
- data=pdf_data,
51
- file_name="NoteAnalyzerTurkish.pdf",
52
- mime="application/pdf"
53
- )
54
 
55
- st.markdown(
56
- f'<iframe src="data:application/pdf;base64,{pdf_data.hex()}" width="700" height="500"></iframe>',
57
- unsafe_allow_html=True
58
- )
59
- else:
60
- st.error("PDF dosyası bulunamadı!")
61
 
62
  #akldnaslkdnmllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
63
  # Notları yükleme ve işleme işlemleri (Butona basıldıysa çalışır)
 
33
 
34
  # Resimler yalnızca show_images True ise gösterilir
35
  if st.session_state.show_images:
 
 
 
36
  # PDF dosyasının yolu
37
  pdf_path = os.path.join("turkish", "NoteAnalyzerTurkish.pdf")
38
 
39
+ # PDF dosyasını base64'e dönüştürme
40
+ with open(pdf_path, "rb") as pdf_file:
41
+ pdf_data = pdf_file.read()
42
+ pdf_base64 = base64.b64encode(pdf_data).decode("utf-8")
 
43
 
44
+ # PDF'yi iframe ile gösterme
45
+ st.markdown(f'<iframe src="data:application/pdf;base64,{pdf_base64}" width="700" height="500"></iframe>', unsafe_allow_html=True)
 
 
 
 
46
 
47
+ # İndirme butonu ekleme
48
+ st.download_button("PDF İndir", data=pdf_data, file_name="NoteAnalyzerTurkish.pdf", mime="application/pdf")
 
 
 
 
49
 
50
  #akldnaslkdnmllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
51
  # Notları yükleme ve işleme işlemleri (Butona basıldıysa çalışır)