Isaac454 commited on
Commit
f273544
·
verified ·
1 Parent(s): ca57e9e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -9
app.py CHANGED
@@ -23,19 +23,22 @@ def translate_english_to_french(text: str) -> str:
23
  Translates English text into French.
24
 
25
  Args:
26
- text: English text to be translated.
27
 
28
  Returns:
29
- The translated French text.
30
  """
31
- prompt = f"""
32
- Translate the following English text into French.
33
- Only return the translated French text.
 
 
 
 
 
 
 
34
 
35
- English:
36
- {text}
37
- """
38
- return prompt
39
 
40
 
41
  @tool
 
23
  Translates English text into French.
24
 
25
  Args:
26
+ text (str): English text to be translated.
27
 
28
  Returns:
29
+ str: The translated French text.
30
  """
31
+ model = HfApiModel(
32
+ model_id="Qwen/Qwen2.5-Coder-32B-Instruct",
33
+ max_tokens=512,
34
+ temperature=0.2,
35
+ )
36
+
37
+ prompt = f"Translate the following English text into French. Output only the translation:\n\n{text}"
38
+
39
+ response = model(prompt)
40
+ return response
41
 
 
 
 
 
42
 
43
 
44
  @tool