VideoDubber / trans.py
Suparnpreet's picture
Upload 7 files
2c1eba3 verified
raw
history blame
1.07 kB
from groq import Groq
def mixtral(script):
client = Groq(api_key="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")
length = len(script)
print("lenghth of script is", length)
completion = client.chat.completions.create(
model="llama3-8b-8192",
messages=[
{
"role": "user",
"content": f"""You have to translate the given text into very simple indian english or hinglish language with basic words or you can also include in just {length+10} words
Do not include any note.
here is the text.
{script}
Translation =
"""
}
],
temperature=0.3,
max_tokens=8192,
top_p=1,
stream=False,
stop=None,
)
print(completion.choices[0].message.content)
print("length of response is ", len(completion.choices[0].message.content))
return completion.choices[0].message.content