apak commited on
Commit
d782c88
·
verified ·
1 Parent(s): 614a658

Update ui_modules.py

Browse files
Files changed (1) hide show
  1. ui_modules.py +33 -17
ui_modules.py CHANGED
@@ -1,32 +1,48 @@
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
  """
 
1
  import gradio as gr
2
 
3
  def create_ui_layout():
4
+ # CSS'e ikon ve kart tasarımları eklendi
5
+ custom_css = """
6
+ .entity-card { border: 1px solid #e0e0e0; padding: 15px; border-radius: 10px; margin-bottom: 15px; background: #ffffff; box-shadow: 2px 2px 5px rgba(0,0,0,0.05); }
7
+ .wiki-section { color: #0056b3; background: #f0f7ff; padding: 5px; border-radius: 5px; margin: 5px 0; }
8
+ .llm-section { color: #155724; background: #f4fff3; padding: 5px; border-radius: 5px; margin: 5px 0; }
9
+ """
10
+
11
+ with gr.Blocks(title="RAG-NER Uzman Sistemi", css=custom_css) as demo:
12
  gr.Markdown("# 🚀 RAG-NER Uzman Karar Destek Sistemi")
13
+
14
  with gr.Tab("Metin Analizi"):
15
+ input_text = gr.Textbox(label="Analiz Edilecek Metin", lines=3, placeholder="Metni buraya girin...")
16
+
17
+ # Eksik olan hazır örnekler burada tanımlandı
18
+ gr.Examples(
19
+ examples=[
20
+ ["Antalya Altın Portakal ödülünü Vizontele filmi aldı."],
21
+ ["Nuri Bilge Ceylan, Kış Uykusu filmiyle Cannes Film Festivali'nde ödül kazandı."],
22
+ ["Amerikalı yazar George Orwell'in 1984 romanı, Apple'ın Macintosh reklamına ilham verdi."],
23
+ ["Android işletim sistemli bir telefon aldım, içinde Python yüklüydü."]
24
+ ],
25
+ inputs=input_text,
26
+ label="Hazır Senaryolar"
27
+ )
28
+
29
  with gr.Row():
30
  log_output = gr.HTML(label="Sistem Akış Günlüğü")
31
+ table_output = gr.Dataframe(headers=["Varlık", "İlk", "Nihai", "Kaynak"], datatype="markdown", wrap=True)
32
+
33
  submit_btn = gr.Button("Analiz Et", variant="primary")
34
+
35
  return demo, input_text, log_output, table_output, submit_btn
36
 
37
+ def format_entity_log(word, wiki, reasoning, label):
38
+ # İkonlar ve hiyerarşik yapı
 
 
 
39
  return f"""
40
  <div class='entity-card'>
41
+ <div style='font-size: 1.2em; font-weight: bold; color: #333;'>🔍 Tespit Edilen: {word}</div>
42
+ <div class='wiki-section'>🌐 <b>Wikipedia:</b> {wiki}</div>
43
+ <div class='llm-section'>🧠 <b>LLM CoT Analizi:</b> {reasoning}</div>
44
+ <div style='margin-top: 10px; border-top: 1px dashed #ccc; pt: 5px;'>
45
+ 🎯 <b>Yeni Etiket:</b> <span style='color: #e67e22; font-size: 1.1em;'>{label}</span>
 
 
 
 
46
  </div>
47
  </div>
48
  """