AI Se Blog Likho! Python Tkinter AI Content Generator Software Free

 Demo :


Click Video πŸ‘‡πŸ‘‡πŸ‘‡













Code : 

import openai

import tkinter as tk

from tkinter import scrolledtext, messagebox


# OpenAI API Key (Replace with your own)

openai.api_key = "YOUR_OPENAI_API_KEY"


# Function to generate AI content

def generate_content():

    topic = entry_topic.get()

    if not topic:

        messagebox.showerror("Error", "Please enter a topic!")

        return

    

    try:

        prompt = f"Write a blog post about {topic} in simple words."

        response = openai.ChatCompletion.create(

            model="gpt-3.5-turbo",

            messages=[{"role": "user", "content": prompt}]

        )

        content = response["choices"][0]["message"]["content"]

        

        # Display content in Text Box

        text_output.delete("1.0", tk.END)

        text_output.insert(tk.END, content)

        

        # Save content to file

        with open("ai_content.txt", "w", encoding="utf-8") as file:

            file.write(content)

        

        messagebox.showinfo("Success", "Content generated & saved successfully!")

    

    except Exception as e:

        messagebox.showerror("Error", f"Failed to generate content: {e}")


# Tkinter GUI Setup

root = tk.Tk()

root.title("AI Content Generator - FuzzuTech")

root.geometry("600x500")

root.config(bg="#222222")


# Input Label

label_topic = tk.Label(root, text="Enter Topic:", font=("Arial", 12, "bold"), fg="white", bg="#222222")

label_topic.pack(pady=5)


# Input Field

entry_topic = tk.Entry(root, font=("Arial", 12), width=50)

entry_topic.pack(pady=5)


# Generate Button

btn_generate = tk.Button(root, text="Generate Content", font=("Arial", 12, "bold"), bg="#28a745", fg="white", command=generate_content)

btn_generate.pack(pady=10)


# Output Box

text_output = scrolledtext.ScrolledText(root, font=("Arial", 12), width=70, height=15, wrap=tk.WORD)

text_output.pack(pady=10)


# Run the Tkinter App

root.mainloop()


Comments

Popular posts from this blog

πŸš€ Simple Login & Registration System in Python Tkinter πŸ“±

πŸš€ Create a Python Screen Recorder with Audio (Complete Code)

Python IP Tracker App with GUI | Track IP Location Real-Time! (Working Project)