Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -45,6 +45,14 @@ def get_llm_hf_inference(model_id=model_id, max_new_tokens=128, temperature=0.7)
|
|
| 45 |
task="text-generation"
|
| 46 |
)
|
| 47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
def get_nasa_apod():
|
| 49 |
url = f"https://api.nasa.gov/planetary/apod?api_key={NASA_API_KEY}"
|
| 50 |
response = requests.get(url)
|
|
@@ -54,14 +62,6 @@ def get_nasa_apod():
|
|
| 54 |
else:
|
| 55 |
return "", "NASA Data Unavailable", "I couldn't fetch data from NASA right now. Please try again later."
|
| 56 |
|
| 57 |
-
def is_apod_query(user_text):
|
| 58 |
-
"""
|
| 59 |
-
Checks if the user's question contains keywords indicating they are asking for
|
| 60 |
-
the Astronomy Picture of the Day.
|
| 61 |
-
"""
|
| 62 |
-
keywords = ["apod", "image", "picture", "photo", "astronomy picture"]
|
| 63 |
-
return any(keyword in user_text.lower() for keyword in keywords)
|
| 64 |
-
|
| 65 |
def analyze_sentiment(user_text):
|
| 66 |
result = sentiment_analyzer(user_text)[0]
|
| 67 |
return result['label']
|
|
|
|
| 45 |
task="text-generation"
|
| 46 |
)
|
| 47 |
|
| 48 |
+
def is_apod_query(user_text):
|
| 49 |
+
"""
|
| 50 |
+
Checks if the user's question contains keywords indicating they are asking for
|
| 51 |
+
the Astronomy Picture of the Day.
|
| 52 |
+
"""
|
| 53 |
+
keywords = ["apod", "image", "picture", "photo", "astronomy picture"]
|
| 54 |
+
return any(keyword in user_text.lower() for keyword in keywords)
|
| 55 |
+
|
| 56 |
def get_nasa_apod():
|
| 57 |
url = f"https://api.nasa.gov/planetary/apod?api_key={NASA_API_KEY}"
|
| 58 |
response = requests.get(url)
|
|
|
|
| 62 |
else:
|
| 63 |
return "", "NASA Data Unavailable", "I couldn't fetch data from NASA right now. Please try again later."
|
| 64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
def analyze_sentiment(user_text):
|
| 66 |
result = sentiment_analyzer(user_text)[0]
|
| 67 |
return result['label']
|