aliicemill commited on
Commit
801bf84
·
verified ·
1 Parent(s): 52d0c14

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -13
app.py CHANGED
@@ -3,7 +3,7 @@ import re
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
@@ -33,22 +33,31 @@ def run_turkish():
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)
 
3
  import numpy as np
4
  import matplotlib.pyplot as plt
5
  from io import BytesIO
6
+ import os
7
 
8
  def run_turkish():
9
  # Başlık
 
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)