برنامه نویسی

دستیار مجازی دسکتاپ [BATMAN] – انجمن DEV

Summarize this content to 400 words in Persian Lang
*'Python'، 'Audio Recognition'، 'OpenAI API'، 'Web automation'، 'API ادغام'*

بتمن را معرفی می‌کنیم، یک دستیار مجازی پیشرفته که با استفاده از پایتون توسعه یافته است تا مهارت‌های من در فناوری‌های پیشرفته را به نمایش بگذارد. این برنامه از کتابخانه speak_recognition استفاده می کند تا با کلمه بیدار بتمن فعال شود و دستورات صوتی بصری را فعال کند. این یکپارچه قابلیت های مرور وب را برای باز کردن وب سایت هایی مانند گوگل، فیس بوک، یوتیوب و لینکدین یکپارچه می کند. این دستیار همچنین دارای پخش موسیقی از طریق یک کتابخانه موسیقی سفارشی است و عناوین اخبار به روز را با استفاده از NewsAPI ارائه می دهد. I از فناوری های تبدیل متن به گفتار با pyttsx3، gTTS و pygame برای ارائه پاسخ های واضح و جذاب استفاده می کند. علاوه بر این، ادغام OpenAI's GPT-3.5-turbo به دستیار اجازه می دهد تا به پرس و جوهای پیچیده با کارایی قابل توجه رسیدگی کند. این پروژه تخصص من در تشخیص صدا، اتوماسیون وب و ادغام API را برجسته می کند و تسلط قوی بر تکنیک های برنامه نویسی مدرن و تعهد به ایجاد راه حل های نوآورانه را نشان می دهد.کد

”’
FEATURES
• Voice Recognition
• Utilizes the speech_recognition library to listen for and recognize voice commands.
• Activates upon detecting the wake word “Jarvis.”
• Text-to-Speech
• Converts text to speech using pyttsx3 for local conversion.
• Uses gTTS (Google Text-to-Speech) and pygame for playback.
• Web Browsing.
• Opens websites like Google, Facebook, YouTube, and LinkedIn based on voice
commands.
• Music Playback
• Interfaces with a musicLibrary module to play songs via web links.
• News Fetching
• Fetches and reads the latest news headlines using NewsAPI.
• OpenAI Integration
• Handles complex queries and generates responses using OpenAI’s GPT-3.5-turbo.
• Acts as a general virtual assistant similar to Alexa or Google Assistant.
• Activates upon detecting the wake word “Jarvis.”
• Text-to-Speech
”’
import speech_recognition as sr
import webbrowser
import pyttsx3
import requests
import pygame
import os

# pip install pocketsphinx

recognizer = sr.Recognizer()
engine = pyttsx3.init()
newsapi = “4409ca2fd24147ab8d0d024fcd117d58”

def speak_old(text):
engine.say(text)
engine.runAndWait()

def speak(text):

# Initialize Pygame mixer
pygame.mixer.init()
# Keep the program running until the music stops playing
while pygame.mixer.music.get_busy():
pygame.time.Clock().tick(10)

pygame.mixer.music.unload()

if __name__ == “__main__”:
speak_old(“Initializing batman….”)
speak_old(‘Hello, I am Aaryans Assistant. How can I help you?’)

while True:
# Listen for the wake word “Batman”
# obtain audio from the microphone
r = sr.Recognizer()

print(“recognizing…”)
try:
with sr.Microphone() as source:
print(“Listening…”)
audio = r.listen(source, timeout=1, phrase_time_limit=2)
word = r.recognize_google(audio)
if(word.lower() == “batman”):
speak_old(“Yes Sir”)
# Listen for command
with sr.Microphone() as source:
print(“Listening Active…”)
audio = r.listen(source)
c = r.recognize_google(audio)
if “open google” in c.lower():
speak_old(” Opening Google”)

webbrowser.open(“https://google.com”)

elif “open facebook” in c.lower():
speak_old(” Opening Facebook”)
webbrowser.open(“https://facebook.com”)

elif “open youtube” in c.lower():
speak_old(” Opening Youtube”)
webbrowser.open(“https://youtube.com”)

elif “open linkedin” in c.lower():
speak_old(” Opening linkedin”)
webbrowser.open(“https://linkedin.com”)
elif “news” in c.lower():
speak_old(“Here are the latest news”)
r = requests.get(f”https://newsapi.org/v2/top-headlines?country=us&apiKey=4409ca2fd24147ab8d0d024fcd117d58″)
if r.status_code == 200:
# Parse the JSON response
data = r.json()

# Extract the articles
articles = data.get(‘articles’, [])

# Print the headlines
for article in articles:
speak_old(article[‘title’])

except Exception as e:
print(“Error; {0}”.format(e))

وارد حالت تمام صفحه شوید

از حالت تمام صفحه خارج شوید

*'Python'، 'Audio Recognition'، 'OpenAI API'، 'Web automation'، 'API ادغام'*

بتمن را معرفی می‌کنیم، یک دستیار مجازی پیشرفته که با استفاده از پایتون توسعه یافته است تا مهارت‌های من در فناوری‌های پیشرفته را به نمایش بگذارد. این برنامه از کتابخانه speak_recognition استفاده می کند تا با کلمه بیدار بتمن فعال شود و دستورات صوتی بصری را فعال کند. این یکپارچه قابلیت های مرور وب را برای باز کردن وب سایت هایی مانند گوگل، فیس بوک، یوتیوب و لینکدین یکپارچه می کند. این دستیار همچنین دارای پخش موسیقی از طریق یک کتابخانه موسیقی سفارشی است و عناوین اخبار به روز را با استفاده از NewsAPI ارائه می دهد. I از فناوری های تبدیل متن به گفتار با pyttsx3، gTTS و pygame برای ارائه پاسخ های واضح و جذاب استفاده می کند. علاوه بر این، ادغام OpenAI's GPT-3.5-turbo به دستیار اجازه می دهد تا به پرس و جوهای پیچیده با کارایی قابل توجه رسیدگی کند. این پروژه تخصص من در تشخیص صدا، اتوماسیون وب و ادغام API را برجسته می کند و تسلط قوی بر تکنیک های برنامه نویسی مدرن و تعهد به ایجاد راه حل های نوآورانه را نشان می دهد.
کد

'''
FEATURES
• Voice Recognition
• Utilizes the speech_recognition library to listen for and recognize voice commands.
• Activates upon detecting the wake word "Jarvis."
• Text-to-Speech
• Converts text to speech using pyttsx3 for local conversion.
• Uses gTTS (Google Text-to-Speech) and pygame for playback.
• Web Browsing.
• Opens websites like Google, Facebook, YouTube, and LinkedIn based on voice
commands.
• Music Playback
• Interfaces with a musicLibrary module to play songs via web links.
• News Fetching
• Fetches and reads the latest news headlines using NewsAPI.
• OpenAI Integration
• Handles complex queries and generates responses using OpenAI's GPT-3.5-turbo.
• Acts as a general virtual assistant similar to Alexa or Google Assistant.
• Activates upon detecting the wake word "Jarvis."
• Text-to-Speech
'''
import speech_recognition as sr
import webbrowser
import pyttsx3
import requests
import pygame
import os

# pip install pocketsphinx

recognizer = sr.Recognizer()
engine = pyttsx3.init() 
newsapi = "4409ca2fd24147ab8d0d024fcd117d58"

def speak_old(text):
    engine.say(text)
    engine.runAndWait()

def speak(text):


    # Initialize Pygame mixer
    pygame.mixer.init()
    # Keep the program running until the music stops playing
    while pygame.mixer.music.get_busy():
        pygame.time.Clock().tick(10)

    pygame.mixer.music.unload()





if __name__ == "__main__":
    speak_old("Initializing batman....")
    speak_old('Hello, I am Aaryans Assistant. How can I help you?')

    while True:
        # Listen for the wake word "Batman"
        # obtain audio from the microphone
        r = sr.Recognizer()

        print("recognizing...")
        try:
            with sr.Microphone() as source:
                print("Listening...")
                audio = r.listen(source, timeout=1, phrase_time_limit=2)
            word = r.recognize_google(audio)
            if(word.lower() == "batman"):
                speak_old("Yes Sir")
                # Listen for command
                with sr.Microphone() as source:
                    print("Listening Active...")
                    audio = r.listen(source)
                    c = r.recognize_google(audio)
                    if "open google" in c.lower():
                            speak_old(" Opening Google")

                            webbrowser.open("https://google.com")

                    elif "open facebook" in c.lower():
                        speak_old(" Opening Facebook")      
                        webbrowser.open("https://facebook.com")

                    elif "open youtube" in c.lower():
                        speak_old(" Opening Youtube")      
                        webbrowser.open("https://youtube.com")

                    elif "open linkedin" in c.lower():
                        speak_old(" Opening linkedin")
                        webbrowser.open("https://linkedin.com")
                    elif "news" in c.lower():
                        speak_old("Here are the latest news")
                        r = requests.get(f"https://newsapi.org/v2/top-headlines?country=us&apiKey=4409ca2fd24147ab8d0d024fcd117d58")
                        if r.status_code == 200:
                            # Parse the JSON response
                            data = r.json()

                            # Extract the articles
                            articles = data.get('articles', [])

                            # Print the headlines
                            for article in articles:
                                speak_old(article['title'])


        except Exception as e:
            print("Error; {0}".format(e))




وارد حالت تمام صفحه شوید

از حالت تمام صفحه خارج شوید

توضیحات تصویر

نوشته های مشابه

دیدگاهتان را بنویسید

نشانی ایمیل شما منتشر نخواهد شد. بخش‌های موردنیاز علامت‌گذاری شده‌اند *

دکمه بازگشت به بالا