|
import gradio as gr |
|
from typing import Dict, List, Any, Optional |
|
from tasks.knowledge_graph import build_knowledge_graph |
|
|
|
from dotenv import load_dotenv |
|
load_dotenv() |
|
|
|
|
|
from ui.summarization_ui import summarization_ui |
|
from ui.translation_ui import translation_ui |
|
from ui.sentiment_ui import sentiment_ui |
|
from ui.topic_ui import topic_ui |
|
from ui.ner_ui import ner_ui |
|
from ui.pos_ui import pos_ui |
|
from ui.kg_ui import kg_ui |
|
from ui.intent_ui import intent_ui |
|
from ui.grammar_ui import grammar_ui |
|
|
|
|
|
def summarization_ui_wrapper(): |
|
return summarization_ui() |
|
|
|
def translation_ui_wrapper(): |
|
return translation_ui() |
|
|
|
def sentiment_analysis_ui_wrapper(): |
|
return sentiment_ui() |
|
|
|
def topic_classification_ui_wrapper(): |
|
return topic_ui() |
|
|
|
def named_entity_recognition_ui_wrapper(): |
|
return ner_ui() |
|
|
|
def pos_tagging_ui_wrapper(): |
|
return pos_ui() |
|
|
|
def extraction_ui(): |
|
return gr.Markdown("Information Extraction is currently under development.") |
|
|
|
def retrieval_ui(): |
|
return gr.Markdown("Text Retrieval is currently under development.") |
|
|
|
def grammar_ui_wrapper(): |
|
return grammar_ui() |
|
|
|
with gr.Blocks(theme=gr.themes.Ocean(), title="Ling - Text Intelligence") as demo: |
|
gr.HTML(''' |
|
<div style="text-align:center; padding: 24px 0 12px 0;"> |
|
<h1 style="font-size:2.5em; margin-bottom:0.2em; color:#0e7490; letter-spacing:2px; font-family:sans-serif;">Ling</h1> |
|
<p style="font-size:1.3em; color:#444; margin-bottom:0.2em;">Text Intelligence Platform for Smart Insights</p> |
|
</div> |
|
''') |
|
with gr.Tab("Summarization"): |
|
summarization_ui_wrapper() |
|
with gr.Tab("Translation"): |
|
translation_ui_wrapper() |
|
with gr.Tab("Sentiment Analysis"): |
|
sentiment_analysis_ui_wrapper() |
|
with gr.Tab("Topic Classification"): |
|
topic_classification_ui_wrapper() |
|
with gr.Tab("NER"): |
|
named_entity_recognition_ui_wrapper() |
|
with gr.Tab("POS Tagging"): |
|
pos_tagging_ui_wrapper() |
|
with gr.Tab("Intent Detection"): |
|
intent_ui() |
|
with gr.Tab("Grammar Checking"): |
|
grammar_ui_wrapper() |
|
with gr.Tab("Knowledge Graph"): |
|
kg_ui() |
|
with gr.Tab("Retrieval"): |
|
retrieval_ui() |
|
|
|
demo.launch() |
|
|