Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -39,7 +39,7 @@ def call_llm(messages, model="deepseek/deepseek-chat-v3-0324:free", max_tokens=3
|
|
| 39 |
return result["choices"][0]["message"]["content"]
|
| 40 |
|
| 41 |
def get_related_images(topic, num_images=3):
|
| 42 |
-
prompt = f"You are an AI
|
| 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'])]
|
|
|
|
| 39 |
return result["choices"][0]["message"]["content"]
|
| 40 |
|
| 41 |
def get_related_images(topic, num_images=3):
|
| 42 |
+
prompt = f"You are an AI trained to return ONLY direct image links from trusted sources like Wikimedia Commons or Unsplash.Give exactly {num_images} raw image URLs (ending in .jpg, .png, or .webp) related to the topic: '{topic}'.Each link should be on a new line, with NO additional text. Start with http."
|
| 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'])]
|