Search

์Œ์„ฑ์ธ์‹ ๋น„์„œ ํ”„๋กœ๊ทธ๋žจ - GPTxPython

ํ”„๋กœ๊ทธ๋žจ ์ด๋ฆ„

์Œ์„ฑ ์ธ์‹์„ ํ†ตํ•ด ํŠน์ • ๋ช…๋ น์–ด๋ฅผ ์ธ์‹ํ•˜์—ฌ ์—ฌ๋Ÿฌ๊ฐ€์ง€ ๊ธฐ๋Šฅ์„ ์ž๋™์œผ๋กœ ์‹คํ–‰ํ•ด์ฃผ๋Š” ํ”„๋กœ๊ทธ๋žจ

ํ”„๋กœ๊ทธ๋žจ

ํ”„๋กฌํ”„ํŠธ

ํŽ˜๋ฅด์†Œ๋‚˜ - ํŒŒ์ด์ฌ ํ”„๋กœ๊ทธ๋ž˜๋ฐ ํ•™์Šต์ž ์ž‘์—… - ์Œ์„ฑ์ธ์‹ ๋น„์„œ ํ”„๋กœ๊ทธ๋žจ ๊ฐœ๋ฐœ ๋งฅ๋ฝ - ์–ธ์–ด : ํŒŒ์ด์ฌ - ๋ฒ„์ „ : 3.13 - ๊ตฌ์กฐ : GUI ํ”„๋กœ๊ทธ๋žจ - ๊ธฐ๋Šฅ * ์‹œ๊ฐ„ ํ™•์ธ - ํ˜„์žฌ ๋‚ ์งœ ์‹œ๊ฐ„์„ notification ์œผ๋กœ ์•Œ๋ ค์ฃผ๊ณ  ์Œ์„ฑ์œผ๋กœ๋„ "ํ˜„์žฌ ์‹œ๊ฐ„์€ ๋ช‡์‹œ ์ž…๋‹ˆ๋‹ค" ๋ผ๊ณ  ์•Œ๋ ค์ค˜ * ๊ฒ€์ƒ‰ - ๊ฒ€์ƒ‰์–ด๋ฅผ ๋‚˜์—๊ฒŒ ๋ฌผ์–ด๋ณด๊ณ  ๊ตฌ๊ธ€์—์„œ ๊ฒ€์ƒ‰ํ•ด์ค˜ * ์›น์‚ฌ์ดํŠธ ์‹คํ–‰ - ๊ตฌ๊ธ€, ์œ ํŠœ๋ธŒ, GPT ํ‚ค์›Œ๋“œ๋ฅผ ์ธ์‹ํ•ด์„œ ํ•ด๋‹น ์‚ฌ์ดํŠธ๋ฅผ ์‹คํ–‰ํ•ด์ค˜ * ํ”„๋กœ๊ทธ๋žจ ์‹คํ–‰ - ZOOM, VS CODE ํ”„๋กœ๊ทธ๋žจ์„ ์ธ์‹ํ•ด์„œ ์‹คํ–‰ํ•ด์ค˜ * ํ”„๋กœ๊ทธ๋žจ ์ข…๋ฃŒ - ํฌ๋กฌ, ZOOM, VS CODE ํ”„๋กœ๊ทธ๋žจ์„ ์ธ์‹ํ•ด์ค˜ ์ข…๋ฃŒ์‹œ์ผœ์ค˜ - "์•ฑ ์ข…๋ฅ˜" ๋ผ๊ณ  ํ•˜๋ฉด ํ˜„์žฌ ๋น„์„œ ํ”„๋กœ๊ทธ๋žจ์„ ์ข…๋ฃŒ์‹œ์ผœ์ค˜ * ๋ฉ”๋ชจ ๊ธฐ๋Šฅ - ๋ฉ”๋ชจ๋ผ๊ณ  ํ‚ค์›Œ๋“œ ์ธ์‹ํ•˜์—ฌ ์Œ์„ฑ์ž…๋ ฅํ•œ ํ…์ŠคํŠธ๋ฅผ ํ˜„์žฌ๋‚ ์งœ์‹œ๊ฐ„_memo.txt ํŒŒ์ผ๋กœ ์Œ์„ฑ ํ…์ŠคํŠธ๋ฅผ ์ €์žฅํ•˜๋Š” ๊ธฐ๋Šฅ ํ˜•์‹ - "์Œ์„ฑ์ธ์‹" ๋ฒ„ํŠผ ๋ˆŒ๋ €์„ ๋•Œ, ๋‚ด ์Œ์„ฑ์„ ์ธ์‹ - "๋ฌด์—‡์„ ๋„์™€๋“œ๋ฆด๊นŒ์š”?" ๋ผ๊ณ  ๋ฉ”์‹œ์ง€๋ฅผ ์ถœ๋ ฅํ•ด์ฃผ๊ณ  ๋‚ด ์Œ์„ฑ์„ ์ž…๋ ฅ๋ฐ›์•„์„œ ์‹œ๊ฐ„, ๊ฒ€์ƒ‰, ์›น์‚ฌ์ดํŠธ ์‹คํ–‰, ํ”„๋กœ๊ทธ๋žจ ์‹คํ–‰ ํ‚ค์›Œ๋“œ๋ฅผ ์ธ์‹ํ•ด์ค˜ - ๊ทธ๋ฆฌ๊ณ  ๊ฐ ๊ธฐ๋Šฅ์— ๋งž๊ฒŒ ์งˆ๋ฌธํ•˜๊ณ  ๊ทธ ๋‹ค์Œ ํ‚ค์›Œ๋“œ๋ฅผ ์ธ์‹ํ•ด์ค˜ ์˜ˆ์‹œ - "๊ฒ€์ƒ‰ํ•ด์ค˜" ๋ผ๊ณ  ํ•˜๋ฉด, "๋ฌด์—‡์„ ๊ฒ€์ƒ‰ํ• ๊นŒ์š”?" ๋ผ๊ณ  ๋ฌผ์–ด๋ณด๊ณ  "ํ‚ค๋ณด๋“œ"๋ผ๊ณ  ๊ฒ€์ƒ‰์–ด๋ฅผ ์•Œ๋ ค์ฃผ๋ฉด, ๊ตฌ๊ธ€์—์„œ "ํ‚ค๋ณด๋“œ"๋ฅผ ๊ฒ€์ƒ‰ํ•ด์ค˜ ์บ”๋ฒ„์Šค ๋ชจ๋“œ๋กœ ์‘๋‹ต
Plain Text
๋ณต์‚ฌ

์ฝ”๋“œ

import tkinter as tk from tkinter import messagebox import speech_recognition as sr import pyttsx3 import webbrowser import datetime import os import subprocess engine = pyttsx3.init() recognizer = sr.Recognizer() def speak(text): assistant_label.config(text=f"๋น„์„œ: {text}") engine.say(text) engine.runAndWait() def recognize_speech(): with sr.Microphone() as source: print("Listening...") audio = recognizer.listen(source) try: user_text = recognizer.recognize_google(audio, language='ko-KR') user_label.config(text=f"๋‚˜: {user_text}") return user_text except sr.UnknownValueError: speak("์ฃ„์†กํ•ด์š”, ์ž˜ ์•Œ์•„๋“ฃ์ง€ ๋ชปํ–ˆ์–ด์š”.") except sr.RequestError: speak("์„œ๋น„์Šค์— ์—ฐ๊ฒฐํ•  ์ˆ˜ ์—†์–ด์š”.") return "" def notify_time(): now = datetime.datetime.now() msg = now.strftime("ํ˜„์žฌ ์‹œ๊ฐ„์€ %Y๋…„ %m์›” %d์ผ %H์‹œ %M๋ถ„ ์ž…๋‹ˆ๋‹ค.") messagebox.showinfo("์‹œ๊ฐ„ ํ™•์ธ", msg) speak(msg) def search_google(): speak("๋ฌด์—‡์„ ๊ฒ€์ƒ‰ํ• ๊นŒ์š”?") query = recognize_speech() if query: webbrowser.open(f"https://www.google.com/search?q={query}") speak(f"{query}์— ๋Œ€ํ•œ ๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ๋ฅผ ๋ณด์—ฌ๋“œ๋ฆด๊ฒŒ์š”.") def open_website(): speak("์–ด๋–ค ์›น์‚ฌ์ดํŠธ๋ฅผ ์—ด๊นŒ์š”? ๊ตฌ๊ธ€, ์œ ํŠœ๋ธŒ, GPT ์ค‘์—์„œ ๋ง์”€ํ•ด์ฃผ์„ธ์š”.") keyword = recognize_speech() urls = { "๊ตฌ๊ธ€": "https://www.google.com", "์œ ํŠœ๋ธŒ": "https://www.youtube.com", "GPT": "https://chat.openai.com" } if keyword in urls: webbrowser.open(urls[keyword]) speak(f"{keyword}๋ฅผ ์—ด๊ฒŒ์š”.") else: speak("ํ•ด๋‹น ์›น์‚ฌ์ดํŠธ๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์–ด์š”.") def run_program(): speak("์–ด๋–ค ํ”„๋กœ๊ทธ๋žจ์„ ์‹คํ–‰ํ• ๊นŒ์š”? ZOOM ๋˜๋Š” VS CODE ์ค‘์—์„œ ๋ง์”€ํ•ด์ฃผ์„ธ์š”.") keyword = recognize_speech().upper() print("์Œ์„ฑ : " + keyword) # ํ”„๋กœ๊ทธ๋žจ ๊ฒฝ๋กœ ์„ค์ • apps = { "ZOOM": "C:\\Users\\User\\AppData\\Roaming\\Zoom\\bin\\Zoom.exe", "์คŒ": "C:\\Users\\User\\AppData\\Roaming\\Zoom\\bin\\Zoom.exe", "VS CODE": "C:\\Users\\User\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe", "VS ์ฝ”๋“œ": "C:\\Users\\User\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe", } # ํ‚ค์›Œ๋“œ๊ฐ€ ํฌํ•จ๋œ ์•ฑ ์ฐพ๊ธฐ matched_apps = [app for app in apps if app.lower() in keyword.lower()] if matched_apps: # ์ผ์น˜ํ•˜๋Š” ์•ฑ ์‹คํ–‰ subprocess.Popen(apps[matched_apps[0]]) # ์ฒซ ๋ฒˆ์งธ ์ผ์น˜ ์•ฑ ์‹คํ–‰ speak(f"{matched_apps[0]}๋ฅผ ์‹คํ–‰ํ• ๊ฒŒ์š”.") else: speak("ํ•ด๋‹น ํ”„๋กœ๊ทธ๋žจ์„ ์ฐพ์„ ์ˆ˜ ์—†์–ด์š”.") def close_program(): speak("์–ด๋–ค ํ”„๋กœ๊ทธ๋žจ์„ ์ข…๋ฃŒํ• ๊นŒ์š”? ํฌ๋กฌ, ZOOM, VS CODE ๋˜๋Š” ์•ฑ ์ข…๋ฃŒ ์ค‘์—์„œ ๋ง์”€ํ•ด์ฃผ์„ธ์š”.") keyword = recognize_speech() # ์ข…๋ฃŒํ•  ํ”„๋กœ๊ทธ๋žจ๋“ค์˜ ํ”„๋กœ์„ธ์Šค ์ด๋ฆ„ ๋”•์…”๋„ˆ๋ฆฌ process_names = { "ํฌ๋กฌ": "chrome.exe", "Chrome": "chrome.exe", "ZOOM": "Zoom.exe", "์คŒ": "Zoom.exe", "VS CODE": "Code.exe", "VS ์ฝ”๋“œ": "Code.exe" } # ํ‚ค์›Œ๋“œ๊ฐ€ ํฌํ•จ๋œ ํ”„๋กœ์„ธ์Šค ์ฐพ๊ธฐ matched_processes = [process for process in process_names if process.lower() in keyword.lower()] if keyword == "์•ฑ ์ข…๋ฃŒ": speak("๋น„์„œ ํ”„๋กœ๊ทธ๋žจ์„ ์ข…๋ฃŒํ•ฉ๋‹ˆ๋‹ค.") root.destroy() elif matched_processes: for process in matched_processes: os.system(f"taskkill /f /im {process_names[process]}") speak(f"{process}๋ฅผ ์ข…๋ฃŒํ–ˆ์–ด์š”.") else: speak("ํ•ด๋‹น ํ”„๋กœ๊ทธ๋žจ์„ ์ฐพ์„ ์ˆ˜ ์—†์–ด์š”.") def memo(): speak("๋ฉ”๋ชจ๋ฅผ ๋ง์”€ํ•ด์ฃผ์„ธ์š”.") text = recognize_speech() if text: now = datetime.datetime.now().strftime("%Y%m%d_%H%M%S") filename = f"{now}_memo.txt" with open(filename, 'w', encoding='utf-8') as f: f.write(text) speak("๋ฉ”๋ชจ๋ฅผ ์ €์žฅํ–ˆ์–ด์š”.") def process_command(command): if "์‹œ๊ฐ„" in command: notify_time() elif "๊ฒ€์ƒ‰" in command: search_google() elif "์›น์‚ฌ์ดํŠธ" in command: open_website() elif "ํ”„๋กœ๊ทธ๋žจ" in command: run_program() elif "์ข…๋ฃŒ" in command: close_program() elif "๋ฉ”๋ชจ" in command: memo() else: speak("๋ฌด์Šจ ๋ง์”€์ธ์ง€ ์ž˜ ๋ชจ๋ฅด๊ฒ ์–ด์š”.") def on_voice_input(): speak("๋ฌด์—‡์„ ๋„์™€๋“œ๋ฆด๊นŒ์š”?") command = recognize_speech() if command: process_command(command) # GUI root = tk.Tk() root.title("์Œ์„ฑ์ธ์‹ ๋น„์„œ") root.geometry("400x300") label = tk.Label(root, text="์Œ์„ฑ์ธ์‹ ๋น„์„œ", font=("Arial", 16)) label.pack(pady=10) btn_voice = tk.Button(root, text="์Œ์„ฑ์ธ์‹", command=on_voice_input, font=("Arial", 14)) btn_voice.pack(pady=10) assistant_label = tk.Label(root, text="๋น„์„œ: ๋Œ€๊ธฐ ์ค‘...", font=("Arial", 20), fg="blue") assistant_label.pack(pady=5) user_label = tk.Label(root, text="๋‚˜: ๋Œ€๊ธฐ ์ค‘...", font=("Arial", 20), fg="green") user_label.pack(pady=5) root.mainloop()
Python
๋ณต์‚ฌ