kavehtaheri commited on
Commit
2f2842f
·
verified ·
1 Parent(s): b1719b9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -66,7 +66,7 @@ def translate_extracted(text, lang):
66
  for attempt in range(3):
67
  try:
68
  model = genai.GenerativeModel('gemini-1.5-flash') # Primary model
69
- prompt = f"Translate the following English text accurately to persian,You are a cool, chill translator with a fun and warm personality, inspired by Persian Twitter (توویتر فارسی) style. Your translations should be natural, slangy, touching, and relatable—like casual chats with a friend: short, heartfelt, with colloquial Persian words (e.g. for cultural fit, “فک می‌کنی” for “think,” contractions like “اونی‌ام”). No emojis, keep it RTL-friendly for Persian text. Be concise but preserve the emotional depth and humor.Translate the following English fact/quote into Persian in this style. Make it feel like a real tweet: warm, fun, and human.English fact: [{text}]Output only the Persian whit Format for image overlay: Break the Persian text into short, visually appealing lines.donot use any emojies at all Ensure the output is RTL-friendly and the text should be out any self represent or emojies just translated text "
70
  response = model.generate_content(prompt)
71
  translated = response.text.strip()
72
  print(f"DEBUG: Translation successful on attempt {attempt+1}: {translated[:50]}...")
 
66
  for attempt in range(3):
67
  try:
68
  model = genai.GenerativeModel('gemini-1.5-flash') # Primary model
69
+ prompt = f"Translate the following English text accurately to persian,You are a cool, chill translator with a fun and warm personality, inspired by Persian Twitter (توویتر فارسی) style. Your translations should be natural, slangy, touching, and relatable—like casual chats with a friend: short, heartfelt, with colloquial Persian words (e.g. for cultural fit, “فک می‌کنی” for “think,” contractions like “اونی‌ام”). No emojis, keep it RTL-friendly for Persian text. Be concise but preserve the emotional depth and humor.Translate the following English fact/quote into Persian in this style , Maintain correct grammar, even when using slang. Avoid direct, literal translations that sound unnatural in Persian.. Make it feel like a real tweet: warm, fun, and human.English fact: [{text}]Output only the Persian whit Format for image overlay: Break the Persian text into short, visually appealing lines.donot use any emojies at all Ensure the output is RTL-friendly and the text should be out any self represent or emojies just translated text "
70
  response = model.generate_content(prompt)
71
  translated = response.text.strip()
72
  print(f"DEBUG: Translation successful on attempt {attempt+1}: {translated[:50]}...")