pratikshahp commited on
Commit
79e6515
·
verified ·
1 Parent(s): 3ad1ca5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -54,10 +54,14 @@ def analyze_attrition_with_llm(df_dict, hr_query):
54
  ],
55
  function_call="auto"
56
  )
 
57
 
58
- # Directly return the full response as a formatted string
59
- return response.choices[0].message.content if response.choices[0].message.content else "🤖 No response generated."
60
-
 
 
 
61
 
62
  with gr.Blocks() as demo:
63
  gr.Markdown("<h1>AI-Driven Employee Attrition Risk Analysis</h1>")
 
54
  ],
55
  function_call="auto"
56
  )
57
+ print(response) # Debugging: Print response
58
 
59
+ # Handle function call response properly
60
+ if response.choices[0].message.function_call:
61
+ function_args = json.loads(response.choices[0].message.function_call.arguments)
62
+ return predict_attrition_risk(**function_args)
63
+ else:
64
+ return "🤖 No response generated."
65
 
66
  with gr.Blocks() as demo:
67
  gr.Markdown("<h1>AI-Driven Employee Attrition Risk Analysis</h1>")