File size: 704 Bytes
6e8e26a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
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()
|