File size: 1,539 Bytes
71e89d6
 
a12a7ee
 
19ec339
 
a12a7ee
19ec339
 
 
a12a7ee
19ec339
 
a12a7ee
 
 
 
753da88
71e89d6
 
 
a12a7ee
753da88
 
a12a7ee
19ec339
 
 
a12a7ee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import gradio as gr

def format_entity_log(word, wiki, reasoning, new_label):
    steps = reasoning.split('|')
    steps_html = "".join([f"<div style='margin-bottom:5px;'>• {s.strip()}</div>" for s in steps if s.strip()])
    
    return f"""
    <div style="border: 1px solid #ddd; border-radius: 8px; padding: 15px; margin-bottom: 10px; background: white;">
        <div style="display: flex; justify-content: space-between; border-bottom: 2px solid #orange; margin-bottom: 10px;">
            <b>🔍 {word}</b> <span style="color:orange;">{new_label}</span>
        </div>
        <p style="font-size:0.9em; background:#f9f9f9; padding:5px;"><b>Wiki:</b> {wiki}</p>
        <div style="font-size:0.85em; color:#555;"><b>Analiz:</b><br>{steps_html}</div>
    </div>
    """

def create_ui_layout():
    with gr.Blocks(theme=gr.themes.Soft(primary_hue="orange")) as demo:
        gr.Markdown("# 🚀 RAG-NER Uzman Karar Destek Sistemi")
        with gr.Tab("Metin Analizi"):
            with gr.Row():
                with gr.Column(scale=2):
                    input_text = gr.Textbox(label="Metin", lines=4)
                    analyze_btn = gr.Button("Analiz Et", variant="primary")
                with gr.Column(scale=1):
                    output_table = gr.Dataframe(headers=["Varlık", "İlk", "Nihai", "Kaynak"], label="Tablo")
            gr.HTML("<hr>") # Divider hatasını bu satır çözer
            output_logs = gr.HTML(label="Muhakeme Kartları")
    return demo, input_text, output_logs, output_table, analyze_btn