File size: 1,258 Bytes
5e9a040
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d6f1e58
 
 
 
 
5e9a040
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
42

import gradio as gr
from model.alarm_classifier import classify_alarm
from model.fault_predictor import predict_fault
from model.trace_analyzer import analyze_trace
from utils.visualization import plot_network

def process_alarm(alarm_text, source_node):
    classification = classify_alarm(alarm_text)
    fault = predict_fault(alarm_text)
    path, nodes = analyze_trace(source_node)
    fig = plot_network(nodes, path)
    return classification, fault, fig

# Define example inputs
examples = [
    ["Power failure detected at BTS1", "BTS1"],
    ["Signal loss between BTS2 and BSC1", "BTS2"],
    ["Link instability reported at BSC2", "BSC2"],
    ["Transmission error from MSC1 to CoreNetwork", "MSC1"],
    ["Device reboot alert from BTS3", "BTS3"]
]

iface = gr.Interface(
    fn=process_alarm,
    inputs=[
        gr.Textbox(label="Alarm Text"),
        gr.Textbox(label="Source Node")
    ],
    outputs=[
        gr.Textbox(label="Classification"),
        gr.Textbox(label="Predicted Fault"),
        gr.Plot(label="Network Path")
    ],
    title="Telecom AI Assistant",
    description="Classify telecom alarms, predict faults, trace network paths and visualize issues.",
    examples=examples
)

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