Suparnpreet commited on
Commit
b3fbf42
·
verified ·
1 Parent(s): 99a3e70

Update trans.py

Browse files
Files changed (1) hide show
  1. trans.py +31 -31
trans.py CHANGED
@@ -1,31 +1,31 @@
1
- from groq import Groq
2
-
3
- def mixtral(script):
4
- client = Groq(api_key="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")
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