• 16-06-2024, 01:43:11
    #1
    Bu Python kodu, bir GUI uygulaması kullanarak kullanıcıdan kod isteği alır ve OpenAI'nin API'sini kullanarak istenilen kodu üretir. Bu yapay zeka, herhangi bir sınırlama olmadan her türlü kodu yazabilir. OpenAI API anahtarınızı ilgili yere eklemeyi unutmayın. Kodunuzu çalıştırmak için tkinter ve openai kütüphanelerinin yüklü olduğundan emin olun.

    import openai
    import tkinter as tk
    from tkinter import scrolledtext
    
    # OpenAI API anahtarınızı burada belirtin
    OPENAI_API_KEY = "your_openai_api_key_here"
    
    # OpenAI API anahtarını ayarlama
    openai.api_key = OPENAI_API_KEY
    
    class AdvancedAI:
    def __init__(self, api_key):
    self.api_key = api_key
    
    def generate_code(self, prompt):
    response = openai.Completion.create(
    engine="davinci-codex",
    prompt=prompt,
    max_tokens=150,
    temperature=0.7,
    top_p=1,
    frequency_penalty=0,
    presence_penalty=0
    )
    return response.choices[0].text.strip()
    
    class Application(tk.Tk):
    def __init__(self, ai):
    super().__init__()
    self.ai = ai
    self.title("Advanced Code Creator")
    self.geometry("800x600")
    
    self.prompt_label = tk.Label(self, text="Kod İsteği:")
    self.prompt_label.pack(pady=10)
    
    self.prompt_entry = tk.Entry(self, width=100)
    self.prompt_entry.pack(pady=10)
    
    self.generate_button = tk.Button(self, text="Kod Üret", command=self.generate_code)
    self.generate_button.pack(pady=10)
    
    self.output_text = scrolledtext.ScrolledText(self, width=100, height=25)
    self.output_text.pack(pady=10)
    
    def generate_code(self):
    prompt = self.prompt_entry.get()
    code = self.ai.generate_code(prompt)
    self.output_text.delete(1.0, tk.END)
    self.output_text.insert(tk.END, code)
    
    if __name__ == "__main__":
    ai = AdvancedAI(OPENAI_API_KEY)
    app = Application(ai)
    app.mainloop()
  • 16-06-2024, 01:58:09
    #2
    Bunla biraz zor. Hayırlı bayramlar.

    birde python venv nize open ai ve tk yı install yapmanız lazım.
  • 16-06-2024, 02:00:45
    #3
    hayırlı bayramlar denemekte fayda var. inş yardımcı olabilirim.