apak commited on
Commit
e4ab695
·
verified ·
1 Parent(s): fef8d11

Update ui_modules.py

Browse files
Files changed (1) hide show
  1. ui_modules.py +23 -11
ui_modules.py CHANGED
@@ -1,20 +1,32 @@
1
  import gradio as gr
2
 
3
  def create_ui_layout():
4
- with gr.Blocks(title="RAG-NER Uzman Sistemi") as demo:
5
  gr.Markdown("# 🚀 RAG-NER Uzman Karar Destek Sistemi")
6
  with gr.Tab("Metin Analizi"):
7
- input_text = gr.Textbox(label="Metin Girişi", lines=3, placeholder="Analiz edilecek cümleyi yazın...")
8
- gr.Examples(examples=[["Nuri Bilge Ceylan, Kış Uykusu filmiyle ödül aldı."], ["1984 romanı Apple reklamında kullanıldı."]], inputs=input_text)
9
-
10
  with gr.Row():
11
- log_output = gr.HTML(label="Sistem Günlüğü")
12
- table_output = gr.Dataframe(headers=["Varlık", "İlk", "Nihai", "Kaynak"], datatype="markdown", wrap=True)
13
  submit_btn = gr.Button("Analiz Et", variant="primary")
14
-
15
  return demo, input_text, log_output, table_output, submit_btn
16
 
17
- def format_log(type, word, content):
18
- colors = {"wiki": "#007bff", "cot": "#28a745", "err": "#dc3545"}
19
- border = colors.get(type, "#ddd")
20
- return f"<div style='margin-left:15px; border-left:3px solid {border}; padding-left:10px; margin-bottom:8px;'><b>{word}:</b> <small>{content}</small></div>"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
 
3
  def create_ui_layout():
4
+ with gr.Blocks(title="RAG-NER Uzman Sistemi", css=".entity-card { border: 1px solid #e0e0e0; padding: 10px; border-radius: 8px; margin-bottom: 10px; background: #fff; }") as demo:
5
  gr.Markdown("# 🚀 RAG-NER Uzman Karar Destek Sistemi")
6
  with gr.Tab("Metin Analizi"):
7
+ input_text = gr.Textbox(label="Metin Girişi", lines=3)
 
 
8
  with gr.Row():
9
+ log_output = gr.HTML(label="Sistem Akış Günlüğü")
10
+ table_output = gr.Dataframe(headers=["Varlık", "İlk", "Nihai", "Kaynak"], datatype="markdown")
11
  submit_btn = gr.Button("Analiz Et", variant="primary")
 
12
  return demo, input_text, log_output, table_output, submit_btn
13
 
14
+ def format_entity_log(word, wiki, cot, final_label):
15
+ """Her varlık için istenen alt alta gösterim yapısı"""
16
+ wiki_icon = "🌐" # İsteğe bağlı olarak base64 svg ikon da koyulabilir
17
+ llm_icon = "🧠"
18
+
19
+ return f"""
20
+ <div class='entity-card'>
21
+ <div style='color: #2c3e50; font-weight: bold; font-size: 1.1em;'>🔍 Tespit Edilen: {word}</div>
22
+ <div style='margin-top: 5px; border-left: 3px solid #007bff; padding-left: 10px;'>
23
+ <small>{wiki_icon} <b>Wikipedia Özeti:</b> {wiki}</small>
24
+ </div>
25
+ <div style='margin-top: 5px; border-left: 3px solid #28a745; padding-left: 10px; background-color: #f9fff9;'>
26
+ <small>{llm_icon} <b>LLM CoT Analizi (Reasoning):</b> {cot}</small>
27
+ </div>
28
+ <div style='margin-top: 5px; font-weight: bold; color: #d35400;'>
29
+ 🎯 Yeni Etiket: {final_label}
30
+ </div>
31
+ </div>
32
+ """