Spaces:
Sleeping

File size: 830 Bytes
5f790d0
 
 
 
 
 
 
 
 
52bcc3e
5f790d0
 
 
 
 
 
 
 
 
 
52bcc3e
5f790d0
52bcc3e
5f790d0
 
52bcc3e
5f790d0
 
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
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