import gradio as gr import requests # Using requests instead of axios for Python def make_decision(budget, interests): interests = interests.split(',') response = requests.post('http://localhost:3001/submitPreferences', { "budget": budget, "interests": interests }) decision = response.json().get("decision") # Convert the response to JSON and get the 'decision' key return decision interface = gr.Interface( fn=make_decision, inputs=[ gr.inputs.Number(label="Budget"), gr.inputs.Textbox(label="Interests (comma separated)") ], outputs=gr.outputs.Textbox(label="Group Decision") ) if __name__ == "__main__": interface.launch()