Skip to content

Create from gtts import gTTS import os # Hinglish text from AI conte #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import openai

# Set up your OpenAI API key
openai.api_key = "your-api-key"

# Define the prompt to generate Hinglish content
prompt = "Generate a motivational message for students struggling with exams in Hinglish."

response = openai.ChatCompletion.create(
model="gpt-4",
messages=[{"role": "user", "content": prompt}]
)

generated_message = response['choices'][0]['message']['content']
print("Generated Hinglish Message:", generated_message)
from gtts import gTTS
import os

# Hinglish text from AI content
hinglish_message = "Aap apne sapno ko sach bana sakte ho agar aap mehnat karenge."

# Convert the text to speech
tts = gTTS(text=hinglish_message, lang='hi') # Using Hindi accent (you can adjust language)
tts.save("output.mp3")

# Play the audio (on Windows)
os.system("start output.mp3")