import gradio as gr import requests MODEL_URL = "https://crisdeyvid-gema-ai-model.hf.space/predict" def bridge_predict(features_text): try: features = [float(x.strip()) for x in features_text.split(",")] except Exception as e: return f"Error: {e}", "" payload = {"features": features} try: resp = requests.post(MODEL_URL, json=payload, timeout=10) result = resp.json() return str(result), result.get("signal", "") except Exception as e: return f"Error al consultar modelo: {e}", "" iface = gr.Interface( fn=bridge_predict, inputs=gr.Textbox(label="Features separados por coma"), outputs=[gr.Textbox(label="Respuesta JSON"), gr.Textbox(label="SeƱal")], title="Bridge - Puente hacia el Modelo IA" ) iface.launch() # <--- SOLO ESTO al final