Tulika2000 commited on
Commit
4f83501
·
verified ·
1 Parent(s): 9f3a2d6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -88,17 +88,21 @@ def safety_advice(user_input, age_range):
88
  if not user_input.strip():
89
  return "<div class='output-box warning-box'>⚠️ Please enter a situation to receive advice.</div>"
90
 
91
- response = chain.invoke({"user_input": user_input, "age_range": age_range})
 
 
 
 
 
92
  links_html = get_youtube_links(age_range)
93
 
94
  # Combine the advice and video links in a single HTML output with styling
95
  combined_output = f"""
96
  <div class='output-box'>
97
  <div class='advice-section'>
98
- {response}
99
  </div>
100
  <div class='video-section'>
101
- <h3>Recommended Videos:</h3>
102
  {links_html}
103
  </div>
104
  </div>
 
88
  if not user_input.strip():
89
  return "<div class='output-box warning-box'>⚠️ Please enter a situation to receive advice.</div>"
90
 
91
+ # Get the response from the language model
92
+ response_obj = chain.invoke({"user_input": user_input, "age_range": age_range})
93
+
94
+ # Extract just the content from the response object
95
+ response_content = response_obj.content if hasattr(response_obj, 'content') else str(response_obj)
96
+
97
  links_html = get_youtube_links(age_range)
98
 
99
  # Combine the advice and video links in a single HTML output with styling
100
  combined_output = f"""
101
  <div class='output-box'>
102
  <div class='advice-section'>
103
+ {response_content}
104
  </div>
105
  <div class='video-section'>
 
106
  {links_html}
107
  </div>
108
  </div>