Ani14 commited on
Commit
06fc2ff
·
verified ·
1 Parent(s): 24eae0e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -1
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 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'])]
 
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'])]