Spaces:
Runtime error
Runtime error
Update trans.py
Browse files
trans.py
CHANGED
|
@@ -1,31 +1,31 @@
|
|
| 1 |
-
from groq import Groq
|
| 2 |
-
|
| 3 |
-
def mixtral(script):
|
| 4 |
-
client = Groq(api_key="
|
| 5 |
-
length = len(script)
|
| 6 |
-
print("lenghth of script is", length)
|
| 7 |
-
completion = client.chat.completions.create(
|
| 8 |
-
model="llama3-8b-8192",
|
| 9 |
-
messages=[
|
| 10 |
-
{
|
| 11 |
-
"role": "user",
|
| 12 |
-
"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
|
| 13 |
-
Do not include any note.
|
| 14 |
-
here is the text.
|
| 15 |
-
|
| 16 |
-
{script}
|
| 17 |
-
|
| 18 |
-
Translation =
|
| 19 |
-
"""
|
| 20 |
-
}
|
| 21 |
-
],
|
| 22 |
-
temperature=0.3,
|
| 23 |
-
max_tokens=8192,
|
| 24 |
-
top_p=1,
|
| 25 |
-
stream=False,
|
| 26 |
-
stop=None,
|
| 27 |
-
|
| 28 |
-
)
|
| 29 |
-
print(completion.choices[0].message.content)
|
| 30 |
-
print("length of response is ", len(completion.choices[0].message.content))
|
| 31 |
-
return completion.choices[0].message.content
|
|
|
|
| 1 |
+
from groq import Groq
|
| 2 |
+
|
| 3 |
+
def mixtral(script):
|
| 4 |
+
client = Groq(api_key="your_api_key")
|
| 5 |
+
length = len(script)
|
| 6 |
+
print("lenghth of script is", length)
|
| 7 |
+
completion = client.chat.completions.create(
|
| 8 |
+
model="llama3-8b-8192",
|
| 9 |
+
messages=[
|
| 10 |
+
{
|
| 11 |
+
"role": "user",
|
| 12 |
+
"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
|
| 13 |
+
Do not include any note.
|
| 14 |
+
here is the text.
|
| 15 |
+
|
| 16 |
+
{script}
|
| 17 |
+
|
| 18 |
+
Translation =
|
| 19 |
+
"""
|
| 20 |
+
}
|
| 21 |
+
],
|
| 22 |
+
temperature=0.3,
|
| 23 |
+
max_tokens=8192,
|
| 24 |
+
top_p=1,
|
| 25 |
+
stream=False,
|
| 26 |
+
stop=None,
|
| 27 |
+
|
| 28 |
+
)
|
| 29 |
+
print(completion.choices[0].message.content)
|
| 30 |
+
print("length of response is ", len(completion.choices[0].message.content))
|
| 31 |
+
return completion.choices[0].message.content
|