Vartex39 commited on
Commit
842626e
·
1 Parent(s): a8d7146

PDF sayfa aralığı girdisi entegre edildi

Browse files
Files changed (1) hide show
  1. ui.py +18 -18
ui.py CHANGED
@@ -4,9 +4,9 @@ from ocr_engine import extract_text_from_image
4
  from pdf_reader import extract_text_chunks_from_pdf
5
  from summarizer import summarize_text
6
 
7
- def process_input(pdf, image, manual_text, mode, model_name):
8
  if pdf is not None:
9
- text_chunks = extract_text_chunks_from_pdf(pdf)
10
  if any("[ERROR]" in chunk for chunk in text_chunks):
11
  return text_chunks[0], "", None
12
  elif image is not None:
@@ -43,19 +43,22 @@ with gr.Blocks() as demo:
43
 
44
  manual_input = gr.Textbox(lines=5, label="Metni Manuel Gir")
45
 
46
- mode_selector = gr.Dropdown(
47
- choices=[
48
- "Teknik Özet",
49
- "Sade Anlatım",
50
- "Eleştir ve Değerlendir",
51
- "Başlık Çıkar",
52
- "Not Formatı",
53
- "Karma Özet" # 🔥 Yeni mod
54
- ],
55
- label="Özetleme Modu",
56
- value="Teknik Özet"
57
- )
58
 
 
 
 
 
 
 
 
 
 
 
 
 
59
 
60
  model_selector = gr.Dropdown(
61
  choices=[
@@ -72,17 +75,14 @@ with gr.Blocks() as demo:
72
 
73
  with gr.Row():
74
  text_output = gr.Textbox(label="Giriş Metni")
75
- copy_status = gr.Textbox(visible=False)
76
  summary_output = gr.Textbox(label="AI Özeti", lines=10, show_copy_button=True)
77
  summary_file = gr.File(label="Özeti İndir", interactive=True)
78
 
79
  submit_btn.click(
80
  fn=process_input,
81
- inputs=[pdf_input, image_input, manual_input, mode_selector, model_selector],
82
  outputs=[text_output, summary_output, summary_file]
83
  )
84
 
85
-
86
-
87
  if __name__ == "__main__":
88
  demo.launch(share=True)
 
4
  from pdf_reader import extract_text_chunks_from_pdf
5
  from summarizer import summarize_text
6
 
7
+ def process_input(pdf, image, manual_text, mode, model_name, start_page, end_page):
8
  if pdf is not None:
9
+ text_chunks = extract_text_chunks_from_pdf(pdf, start=int(start_page), end=int(end_page))
10
  if any("[ERROR]" in chunk for chunk in text_chunks):
11
  return text_chunks[0], "", None
12
  elif image is not None:
 
43
 
44
  manual_input = gr.Textbox(lines=5, label="Metni Manuel Gir")
45
 
46
+ with gr.Row():
47
+ start_page = gr.Number(label="Başlangıç Sayfası", value=1, precision=0)
48
+ end_page = gr.Number(label="Bitiş Sayfası", value=5, precision=0)
 
 
 
 
 
 
 
 
 
49
 
50
+ mode_selector = gr.Dropdown(
51
+ choices=[
52
+ "Teknik Özet",
53
+ "Sade Anlatım",
54
+ "Eleştir ve Değerlendir",
55
+ "Başlık Çıkar",
56
+ "Not Formatı",
57
+ "Karma Özet"
58
+ ],
59
+ label="Özetleme Modu",
60
+ value="Teknik Özet"
61
+ )
62
 
63
  model_selector = gr.Dropdown(
64
  choices=[
 
75
 
76
  with gr.Row():
77
  text_output = gr.Textbox(label="Giriş Metni")
 
78
  summary_output = gr.Textbox(label="AI Özeti", lines=10, show_copy_button=True)
79
  summary_file = gr.File(label="Özeti İndir", interactive=True)
80
 
81
  submit_btn.click(
82
  fn=process_input,
83
+ inputs=[pdf_input, image_input, manual_input, mode_selector, model_selector, start_page, end_page],
84
  outputs=[text_output, summary_output, summary_file]
85
  )
86
 
 
 
87
  if __name__ == "__main__":
88
  demo.launch(share=True)