Vartex39 commited on
Commit
940be83
·
1 Parent(s): fe09770

summarizer.py dinamik model seçimine göre çalışacak şekilde güncellendi

Browse files
Files changed (1) hide show
  1. ui.py +13 -3
ui.py CHANGED
@@ -3,7 +3,7 @@ from ocr_engine import extract_text_from_image
3
  from pdf_reader import extract_text_from_pdf
4
  from summarizer import summarize_text
5
 
6
- def process_input(pdf, image, manual_text, mode):
7
  if pdf is not None:
8
  text = extract_text_from_pdf(pdf)
9
  elif image is not None:
@@ -16,7 +16,7 @@ def process_input(pdf, image, manual_text, mode):
16
  if "[ERROR]" in text or "[INFO]" in text:
17
  return text, ""
18
 
19
- summary = summarize_text(text, mode)
20
  return text, summary
21
 
22
  with gr.Blocks() as demo:
@@ -34,6 +34,16 @@ with gr.Blocks() as demo:
34
  value="Teknik Özet"
35
  )
36
 
 
 
 
 
 
 
 
 
 
 
37
  with gr.Row():
38
  submit_btn = gr.Button("Özetle")
39
 
@@ -43,7 +53,7 @@ with gr.Blocks() as demo:
43
 
44
  submit_btn.click(
45
  fn=process_input,
46
- inputs=[pdf_input, image_input, manual_input, mode_selector],
47
  outputs=[text_output, summary_output]
48
  )
49
 
 
3
  from pdf_reader import extract_text_from_pdf
4
  from summarizer import summarize_text
5
 
6
+ def process_input(pdf, image, manual_text, mode, model_name):
7
  if pdf is not None:
8
  text = extract_text_from_pdf(pdf)
9
  elif image is not None:
 
16
  if "[ERROR]" in text or "[INFO]" in text:
17
  return text, ""
18
 
19
+ summary = summarize_text(text, mode, model_name)
20
  return text, summary
21
 
22
  with gr.Blocks() as demo:
 
34
  value="Teknik Özet"
35
  )
36
 
37
+ model_selector = gr.Dropdown(
38
+ choices=[
39
+ "anthropic/claude-3-haiku",
40
+ "openai/gpt-3.5-turbo",
41
+ "mistralai/mistral-7b-instruct"
42
+ ],
43
+ label="Dil Modeli",
44
+ value="anthropic/claude-3-haiku"
45
+ )
46
+
47
  with gr.Row():
48
  submit_btn = gr.Button("Özetle")
49
 
 
53
 
54
  submit_btn.click(
55
  fn=process_input,
56
+ inputs=[pdf_input, image_input, manual_input, mode_selector, model_selector],
57
  outputs=[text_output, summary_output]
58
  )
59