File size: 1,360 Bytes
c3af845
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
30
31
32
33
34
35
36
37
38
39
40
41
# main.py
import gradio as gr
from src.analyzer import EventAnalyzer
from ui.format import ResultFormatter
from ui.styles import css

# Initialize analyzer
analyzer = EventAnalyzer()

async def process_input(text: str) -> str:
    """Process input text and return formatted HTML results."""
    result = await analyzer.analyze_event(text)
    return ResultFormatter.format_results(result)

# Define example inputs
EXAMPLES = [
    ["John from Tech Corp. is attending the meeting in Washington, DC tomorrow at 14:30 #tech"],
    ["Sarah Johnson and Mike Smith from Defense Systems Inc. are conducting training in Norfolk, VA on June 15th #defense #training"],
    ["Team meeting at headquarters with @commander_smith at 0900 #briefing"]
]

# Create Gradio interface
demo = gr.Interface(
    fn=process_input,
    inputs=[
        gr.Textbox(
            label="Event Text",
            placeholder="Enter text to analyze (e.g., 'John from Tech Corp. is attending the meeting in Washington, DC tomorrow at 14:30 #tech')",
            lines=3
        )
    ],
    outputs=gr.HTML(),
    title="Event Analysis System",
    description="Analyze text to extract entities, assess confidence, and identify key event information with relationship tracking.",
    css=css,
    theme=gr.themes.Soft(),
    examples=EXAMPLES
)

if __name__ == "__main__":
    demo.launch()