Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -41,7 +41,7 @@ def call_llm(messages, model="deepseek/deepseek-chat-v3-0324:free", max_tokens=3
|
|
| 41 |
def get_related_images(topic, num_images=3):
|
| 42 |
prompt = f"You are an AI assistant helping to find visuals. Please return {num_images} direct image URLs (one per line) that are relevant to the topic: '{topic}'. Ensure each line is a raw direct link to an image file (ending in .jpg, .png, etc.) and nothing else."
|
| 43 |
try:
|
| 44 |
-
content = call_llm([{"role": "user", "content": prompt}])
|
| 45 |
urls = [line.strip() for line in content.split('\n') if line.strip().startswith("http") and any(ext in line for ext in ['.jpg', '.jpeg', '.png', '.webp'])]
|
| 46 |
return urls[:num_images]
|
| 47 |
except Exception as e:
|
|
|
|
| 41 |
def get_related_images(topic, num_images=3):
|
| 42 |
prompt = f"You are an AI assistant helping to find visuals. Please return {num_images} direct image URLs (one per line) that are relevant to the topic: '{topic}'. Ensure each line is a raw direct link to an image file (ending in .jpg, .png, etc.) and nothing else."
|
| 43 |
try:
|
| 44 |
+
content = call_llm([{"role": "user", "content": prompt}], model="deepseek/deepseek-chat-v3-0324:free")
|
| 45 |
urls = [line.strip() for line in content.split('\n') if line.strip().startswith("http") and any(ext in line for ext in ['.jpg', '.jpeg', '.png', '.webp'])]
|
| 46 |
return urls[:num_images]
|
| 47 |
except Exception as e:
|