ํ๋ก๊ทธ๋จ ์ด๋ฆ
์์ฑ ์ธ์์ ํตํด ํน์ ๋ช
๋ น์ด๋ฅผ ์ธ์ํ์ฌ ์ฌ๋ฌ๊ฐ์ง ๊ธฐ๋ฅ์ ์๋์ผ๋ก ์คํํด์ฃผ๋ ํ๋ก๊ทธ๋จ
ํ๋ก๊ทธ๋จ
ํ๋กฌํํธ
ํ๋ฅด์๋
- ํ์ด์ฌ ํ๋ก๊ทธ๋๋ฐ ํ์ต์
์์
- ์์ฑ์ธ์ ๋น์ ํ๋ก๊ทธ๋จ ๊ฐ๋ฐ
๋งฅ๋ฝ
- ์ธ์ด : ํ์ด์ฌ
- ๋ฒ์ : 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
๋ณต์ฌ