π₯ Generate Viral Instagram Captions with openai – Python GUI App (Offline Tool) | FuzzuTech
Demo :
Click Video πππ
✅Features:
-
YouTube embedded short
-
Code snippet screenshot (main window)
-
Button: “Download Python Code” (optional link to GitHub/GDrive)
-
SEO Meta: Python GUI Caption Tool, AI Instagram Caption Generator, Offline Caption App
Code :
import tkinter as tk
import customtkinter as ctk
import random
# import openai # Uncomment this line if you want to use OpenAI
# openai.api_key = "your-api-key" # Add your OpenAI API key here if needed
# Predefined topic-based captions (fallback)
captions = {
"travel": [
"Wander often, wonder always π✈️",
"Collecting memories, not things ✨",
"New places, new faces ππΈ"
],
"food": [
"Foodie vibes only ππ",
"Good food = Good mood π",
"In a serious relationship with food ❤️"
],
"gym": [
"Sweat now, shine later πͺπ₯",
"No pain, no gain π️♂️",
"Train insane or remain the same π"
],
"love": [
"Love is the only magic I believe in π✨",
"Falling in love with every moment π",
"You + Me = ❤️"
],
"fashion": [
"Style is a way to say who you are ππ₯",
"Slaying every outfit, every day ππΊ",
"OOTD goals π«π "
],
"default": [
"Living my best life π",
"Caption this π€π",
"Smile. Sparkle. Shine ✨"
]
}
# Caption generator (fallback)
def generate_caption(prompt):
topic = prompt.lower()
selected = captions.get(topic, captions["default"])
return random.choice(selected)
# OpenAI version (optional – disabled)
'''
def generate_caption(prompt):
try:
response = openai.Completion.create(
engine="text-davinci-003",
prompt=f"Generate an Instagram caption for: {prompt}",
max_tokens=60,
temperature=0.9
)
return response.choices[0].text.strip()
except Exception as e:
return "Error: " + str(e)
'''
# GUI setup
ctk.set_appearance_mode("dark")
ctk.set_default_color_theme("green")
app = ctk.CTk()
app.title("Instagram Caption Generator")
app.geometry("500x500")
app.resizable(False, False)
ctk.CTkLabel(app, text="Instagram Caption Generator", font=("Arial Bold", 22)).pack(pady=20)
entry = ctk.CTkEntry(app, placeholder_text="Enter topic (e.g. travel, food, gym)", width=400)
entry.pack(pady=10)
output = ctk.CTkTextbox(app, width=450, height=150, font=("Arial", 14), wrap="word")
output.pack(pady=10)
output.insert("1.0", "Your caption will appear here...")
output.configure(state="disabled")
def on_generate():
topic = entry.get().strip()
caption = generate_caption(topic)
output.configure(state="normal")
output.delete("1.0", tk.END)
output.insert("1.0", caption)
output.configure(state="disabled")
ctk.CTkButton(app, text="Generate Caption", command=on_generate, width=200).pack(pady=15)
ctk.CTkLabel(app, text="Made by FuzzuTech", font=("Arial", 12)).pack(pady=10)
app.mainloop()
Comments
Post a Comment