import gradio as gr from transformers import pipeline # Load your model from Hugging Face Hub pipe = pipeline("text2text-generation", model="rbarac/open-rotor-copilot") # Or your exact model/task def analyze_text_input(input_str): # Input_str could be: "gyro_std=123.4, vbat_drop=0.91, ..." etc. result = pipe(input_str) out = result[0].get("generated_text") return out iface = gr.Interface( fn=analyze_text_input, inputs=gr.Textbox(label="Feature string", placeholder="gyro_std=123.4, vbat_drop=0.91, ...", value="Gyro stddev=10.29, Throttle mean=1736, Motors min=12.07, max=54.96, Motor stall count=0, Max gyro roll diff=51.60, Max PID axis=4.29, Min/Max window=(12.07/54.96), Motor diff max=9.32, Prop damage frac=0.00, Gyro abs max=165.38, Vbat min/max=(19.58/21.94), Vbat drop=2.37, Amperage max=4.39, Brownout count=0, Brownout frac=0.00, RSSI min=53.25, RX loss rate=0.000, RC jitter max=10.5, GPS loss rate=0.001, Acc norm mean=0.98, Acc drift=0.02, Alt jump max=0.11, Heading jump max=0.23"), outputs=gr.Textbox(label="Detected Issue / Reason"), title="Open Rotor Copilot (Single Example)", description="Paste a windowed feature string and get detected issue & explanation." ) if __name__ == "__main__": iface.launch()