import google.generativeai as genai import os import time import csv import subprocess import matplotlib.pyplot as plt import random import matplotlib.font_manager as fm from google.generativeai.types import HarmCategory, HarmBlockThreshold #15 per minute = 60/15=4 seconds print(os.environ["GEMINI_API_KEY"]) from google import genai client = genai.Client(api_key=os.environ["GEMINI_API_KEY"]) #nano ~/.bashrc #export GEMINI_API_KEY= data="" with open('quran-simple.txt') as f: file_content = f.read() data = file_content.splitlines() for i in range(0, len(data)): try: time.sleep(6) # Select next row english = data[i] #extract english print(english) response = client.models.generate_content( model="gemini-2.5-flash", contents="You are an Arabic English translator. I will give you an arabic sentence. Translate the sentence to english. Do not output any arabic text or breakdown. You are using the arabic sentence only for reference or source material.Your job is to teach/tutor Arabic to an english student. Provide a word for word explanation/break down in english so that one can understand the Arabic words. Also provide pronunciation assistance always next to the translated word. if needed, provide grammar rules. The sentence is " + english, ) print(response.text) # Save the response to a file with open(f'content_{i+1}.txt', 'w') as file: str = response.text file.write( str) except: print('yee')