SHAMIL SHAHBAZ AWAN
commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -20,7 +20,7 @@ else:
|
|
| 20 |
"""
|
| 21 |
Use Tavily API to fetch real-time suggestions based on location and need.
|
| 22 |
"""
|
| 23 |
-
query = f"Provide
|
| 24 |
|
| 25 |
try:
|
| 26 |
# Execute the query using TavilyClient
|
|
@@ -34,6 +34,9 @@ else:
|
|
| 34 |
"""
|
| 35 |
Use the Groq model to enhance and organize the suggestions.
|
| 36 |
"""
|
|
|
|
|
|
|
|
|
|
| 37 |
groq_client = Groq(api_key=GROQ_API_KEY)
|
| 38 |
|
| 39 |
try:
|
|
@@ -70,9 +73,13 @@ else:
|
|
| 70 |
st.write("Raw Suggestions from Tavily:")
|
| 71 |
st.write(tavily_suggestions)
|
| 72 |
|
| 73 |
-
#
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
else:
|
| 78 |
st.warning("Please enter your location to get recommendations.")
|
|
|
|
| 20 |
"""
|
| 21 |
Use Tavily API to fetch real-time suggestions based on location and need.
|
| 22 |
"""
|
| 23 |
+
query = f"Provide internet connectivity options for rural areas near {location}, especially affordable providers."
|
| 24 |
|
| 25 |
try:
|
| 26 |
# Execute the query using TavilyClient
|
|
|
|
| 34 |
"""
|
| 35 |
Use the Groq model to enhance and organize the suggestions.
|
| 36 |
"""
|
| 37 |
+
if suggestions == "No suggestions available.":
|
| 38 |
+
return "It seems like we couldn't find any suggestions. Try asking in a different way or checking with local ISPs."
|
| 39 |
+
|
| 40 |
groq_client = Groq(api_key=GROQ_API_KEY)
|
| 41 |
|
| 42 |
try:
|
|
|
|
| 73 |
st.write("Raw Suggestions from Tavily:")
|
| 74 |
st.write(tavily_suggestions)
|
| 75 |
|
| 76 |
+
# Check if the response is empty before passing to Groq
|
| 77 |
+
if tavily_suggestions != "No suggestions available.":
|
| 78 |
+
# Enhance the response using Groq
|
| 79 |
+
enhanced_suggestions = enhance_with_groq(tavily_suggestions)
|
| 80 |
+
st.subheader("Enhanced Suggestions:")
|
| 81 |
+
st.write(enhanced_suggestions)
|
| 82 |
+
else:
|
| 83 |
+
st.warning("No suggestions available. Try refining your query.")
|
| 84 |
else:
|
| 85 |
st.warning("Please enter your location to get recommendations.")
|