Spaces:
Sleeping
Sleeping
Update ui_modules.py
Browse files- ui_modules.py +7 -18
ui_modules.py
CHANGED
|
@@ -3,29 +3,18 @@ import gradio as gr
|
|
| 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 |
-
|
| 7 |
with gr.Tab("Metin Analizi"):
|
| 8 |
-
input_text = gr.Textbox(label="
|
| 9 |
-
|
| 10 |
-
examples = gr.Examples(
|
| 11 |
-
examples=[["Nuri Bilge Ceylan, Kış Uykusu filmiyle ödül aldı."], ["1984 romanı Apple reklamında kullanıldı."]],
|
| 12 |
-
inputs=input_text
|
| 13 |
-
)
|
| 14 |
|
| 15 |
with gr.Row():
|
| 16 |
log_output = gr.HTML(label="Sistem Günlüğü")
|
| 17 |
-
table_output = gr.Dataframe(
|
| 18 |
-
headers=["Varlık", "İlk", "Nihai", "Kaynak"],
|
| 19 |
-
datatype="markdown"
|
| 20 |
-
)
|
| 21 |
-
|
| 22 |
submit_btn = gr.Button("Analiz Et", variant="primary")
|
| 23 |
|
| 24 |
return demo, input_text, log_output, table_output, submit_btn
|
| 25 |
|
| 26 |
-
def
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
return f"<div style='margin-left:20px; border-left:4px solid #28a745; padding-left:10px; background-color:#f8fff8; margin-bottom:10px;'>💡 <b>{word}</b><br><small>{content}</small></div>"
|
| 31 |
-
return f"<div>{content}</div>"
|
|
|
|
| 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>"
|
|
|
|
|
|