Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -66,6 +66,18 @@ def is_apod_query(user_text):
|
|
66 |
keywords = ["apod", "image", "picture", "photo", "astronomy picture"]
|
67 |
return any(keyword in user_text.lower() for keyword in keywords)
|
68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
def generate_follow_up(user_text):
|
70 |
"""
|
71 |
Generates two variant follow-up questions and randomly selects one.
|
|
|
66 |
keywords = ["apod", "image", "picture", "photo", "astronomy picture"]
|
67 |
return any(keyword in user_text.lower() for keyword in keywords)
|
68 |
|
69 |
+
def predict_action(user_text):
|
70 |
+
"""
|
71 |
+
Determines the type of response for the user's query.
|
72 |
+
If the query contains "NASA" or "space" and also indicates an APOD query,
|
73 |
+
it returns "nasa_info". Otherwise, it returns "general_query", even if "NASA" is present.
|
74 |
+
"""
|
75 |
+
user_text_lower = user_text.lower()
|
76 |
+
if "nasa" in user_text_lower or "space" in user_text_lower:
|
77 |
+
if is_apod_query(user_text):
|
78 |
+
return "nasa_info"
|
79 |
+
return "general_query"
|
80 |
+
|
81 |
def generate_follow_up(user_text):
|
82 |
"""
|
83 |
Generates two variant follow-up questions and randomly selects one.
|