Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -120,7 +120,7 @@ def generate_response(user_query, relevant_segment):
|
|
120 |
except Exception as e:
|
121 |
print(f"Error in generating response: {e}")
|
122 |
return f"Error in generating response: {e}"
|
123 |
-
|
124 |
def query_model(question):
|
125 |
"""
|
126 |
Process a question, find relevant information, and generate a response.
|
@@ -133,10 +133,32 @@ def query_model(question):
|
|
133 |
if "sacramento" in question.lower():
|
134 |
return "There are many locations near Sacramento where you can stargaze: Kalithea Park, Northstar Park, Curtis Park, Lake Theodore, Casa Bella Verde, McKinley Park, Tiscornia Park, Old Sacramento Waterfront.", "https://huggingface.co/spaces/Starfinders/Stars/resolve/main/SACROMENTO%20CANVA"
|
135 |
if "los angeles" in question.lower() or "la" in question.lower():
|
136 |
-
return "There are many locations near Los Angeles where you can stargaze: Leo Carrillo State Beach (Malibu), Malibu Creek State Park (Malibu), Griffith Observatory (Griffith Park), Mount Wilson Observatory (Angeles Crest)", "https://huggingface.co/spaces/Starfinders/Stars/resolve/main/
|
137 |
-
|
138 |
-
|
139 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
relevant_segment = find_relevant_segment(question, segments)
|
141 |
if not relevant_segment:
|
142 |
return "Could not find specific information. Please refine your question.", None
|
|
|
120 |
except Exception as e:
|
121 |
print(f"Error in generating response: {e}")
|
122 |
return f"Error in generating response: {e}"
|
123 |
+
# below perfect code
|
124 |
def query_model(question):
|
125 |
"""
|
126 |
Process a question, find relevant information, and generate a response.
|
|
|
133 |
if "sacramento" in question.lower():
|
134 |
return "There are many locations near Sacramento where you can stargaze: Kalithea Park, Northstar Park, Curtis Park, Lake Theodore, Casa Bella Verde, McKinley Park, Tiscornia Park, Old Sacramento Waterfront.", "https://huggingface.co/spaces/Starfinders/Stars/resolve/main/SACROMENTO%20CANVA"
|
135 |
if "los angeles" in question.lower() or "la" in question.lower():
|
136 |
+
return "There are many locations near Los Angeles where you can stargaze: Leo Carrillo State Beach (Malibu), Malibu Creek State Park (Malibu), Griffith Observatory (Griffith Park), Mount Wilson Observatory (Angeles Crest)", "https://huggingface.co/spaces/Starfinders/Stars/resolve/main/LOS%20ANGELES%20CANVA.png"
|
137 |
+
|
138 |
+
# above perfect code
|
139 |
+
|
140 |
+
if "Orion" in question.lower():
|
141 |
+
return "Best viewed from January to March in the Northern Hemisphere; known for the iconic Orion's Belt, consisting of the three stars Alnitak, Alnilam, and Mintaka, and is flanked by the bright stars Betelgeuse and Rigel. Orion is often associated with the Greek myth of the great hunter who was placed among the stars by Zeus.", "https://huggingface.co/spaces/Starfinders/Stars/resolve/main/SF%20CANVAhttps://huggingface.co/spaces/Starfinders/Stars/resolve/main/orion%20.png"
|
142 |
+
if "Ursa Major" in question.lower():
|
143 |
+
return "Visible year-round in the Northern Hemisphere; home to the Big Dipper, an asterism used for navigation and to find Polaris. In mythology, Ursa Major represents Callisto, a nymph who was transformed into a bear by Zeus and placed in the sky.","https://huggingface.co/spaces/Starfinders/Stars/resolve/main/ursa%20major.png"
|
144 |
+
if "Ursa Minor" in question.lower():
|
145 |
+
return "Also visible year-round in the Northern Hemisphere; contains Polaris, the current North Star, which has been a vital navigational tool throughout history. It represents Arcas, the son of Callisto, who was also turned into a bear and placed near his mother in the sky.","https://huggingface.co/spaces/Starfinders/Stars/resolve/main/ursa%20minor.png"
|
146 |
+
if "Cassiopeia" in question.lower():
|
147 |
+
return " Best seen in the autumn months; notable for its distinctive "W" shape, which represents the vain queen Cassiopeia from Greek mythology. She was punished by being placed in the sky, where she circles the North Star, sometimes appearing upside-down.","https://huggingface.co/spaces/Starfinders/Stars/resolve/main/Cassiopeia%20.png"
|
148 |
+
if "Cyngnus" in question.lower():
|
149 |
+
return "Most visible in the summer; contains the Northern Cross asterism and the bright star Deneb, which forms part of the Summer Triangle. Cygnus, the Swan, is often associated with the story of Zeus transforming into a swan or the tale of Phaethon, who fell into the Eridanus river.","https://huggingface.co/spaces/Starfinders/Stars/resolve/main/Cygnus.png"
|
150 |
+
if "Scropius" in question.lower():
|
151 |
+
return "Best seen in July and August; easily recognized by the bright red star Antares at its heart and its curved "tail" of stars. Scorpius is linked to the myth of the scorpion sent by Gaia to kill Orion, which explains why they are placed on opposite sides of the sky.","https://huggingface.co/spaces/Starfinders/Stars/resolve/main/SCORPIUS.png"
|
152 |
+
if "Leo" in question.lower():
|
153 |
+
return "Best viewed in April; known for the sickle-shaped pattern representing the lion's mane and the bright star Regulus, which is known as the "Heart of the Lion." Leo is associated with the Nemean Lion, a beast slain by Hercules as one of his twelve labors.","https://huggingface.co/spaces/Starfinders/Stars/resolve/main/leo.png"
|
154 |
+
if "Taurus" in question.lower():
|
155 |
+
return "Best visible in November and December; characterized by the bright red star Aldebaran and the nearby Pleiades star cluster, also known as the Seven Sisters. In mythology, Taurus represents the bull form of Zeus, who abducted Europa.","https://huggingface.co/spaces/Starfinders/Stars/resolve/main/Taurus%20.png"
|
156 |
+
if "Gemini" in question.lower():
|
157 |
+
return "Best seen in February and March; features the twin stars Castor and Pollux, named after the mythological twins who were granted shared immortality by Zeus. The constellation is often associated with companionship and duality.","https://huggingface.co/spaces/Starfinders/Stars/resolve/main/Gemini.png"
|
158 |
+
if "Libra" in question.lower():
|
159 |
+
return "Best viewed in June; symbolizes the scales of justice and balance, often associated with the Greek goddess Astraea. Libra is one of the few constellations representing an inanimate object, highlighting its unique role as a symbol of equilibrium and fairness.","https://huggingface.co/spaces/Starfinders/Stars/resolve/main/Libra.png"
|
160 |
+
|
161 |
+
#below perfect code
|
162 |
relevant_segment = find_relevant_segment(question, segments)
|
163 |
if not relevant_segment:
|
164 |
return "Could not find specific information. Please refine your question.", None
|