import json import gradio as gr import requests def remote_inference(text): url = "http://54.241.102.71:5001/invocations" payload = json.dumps({ "dataframe_split": { "columns": ["text"], "data": [[text]] } }) headers = { 'Content-Type': 'application/json' } response = requests.request("POST", url, headers=headers, data=payload) return { "nodes": response.json()["predictions"][0]["0"], "links": response.json()["predictions"][1]["0"] } iface = gr.Interface(fn=remote_inference, inputs="text", outputs="json") iface.launch()