FrederickSundeep's picture
updated commit 009
d6f1e58
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()