| ''' | |
| You can change the AI model by modifying the function 'AskAI()' below. | |
| ''' | |
| import requests | |
| import urllib.parse | |
| class AIModel: | |
| def AskAI(self, prompt: str) -> str: | |
| base_url = "https://text.pollinations.ai/" | |
| encoded_prompt = urllib.parse.quote(prompt) | |
| full_url = base_url + encoded_prompt | |
| response = requests.get(full_url) | |
| if response.status_code == 200: | |
| return response.text | |
| else: | |
| return f"<error> | Error: {response.status_code} - {response.text}" | |
| if __name__ == "__main__": | |
| model = AIModel() | |
| print(model.AskAI("Tell me the capital of France, please.")) | |