JosephH commited on
Commit
95c7396
·
verified ·
1 Parent(s): 674ac49

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -23
app.py CHANGED
@@ -9,31 +9,31 @@ from predibase import Predibase
9
  pb = Predibase(api_token=top_secret_key)
10
  client = pb.deployments.client("gemma-2-9b")
11
 
12
- def process_text(text,temperature):
13
- text_input = text
14
- control_prompt = f"""You are an advanced translation model specializing in translating texts from the Ottoman language (old Turkish) to English. Your task is to produce accurate, fluent, and contextually appropriate translations. Maintain the original meaning, tone, and style of the text as much as possible. For religious or culturally significant phrases, try to preserve their essence and convey the intended respect and significance.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
- ### Ottoman text:
17
- {text_input}
18
 
19
- ### English text:
20
- """
21
-
22
- try:
23
- # Assuming `client` is your pre-defined translation model client
24
- result = client.generate(
25
- control_prompt,
26
- adapter_id="gemma-2-9b/1",
27
- max_new_tokens=512,
28
- temperature=0.7,
29
- top_p=0.95,
30
- top_k=50
31
- ).generated_text
32
-
33
- return f"{result}"
34
- except Exception as e:
35
-
36
- return "Maalesef şuanda sunucu meşgul, lütfen biraz sonra bir daha deneyin!"
37
 
38
  custom_css = """
39
  <style>
 
9
  pb = Predibase(api_token=top_secret_key)
10
  client = pb.deployments.client("gemma-2-9b")
11
 
12
+ def process_text(text,temperature):
13
+ text_input = text
14
+ control_prompt = f"""You are an advanced translation model specializing in translating texts from the Ottoman language (old Turkish) to English. Your task is to produce accurate, fluent, and contextually appropriate translations. Maintain the original meaning, tone, and style of the text as much as possible. For religious or culturally significant phrases, try to preserve their essence and convey the intended respect and significance.
15
+
16
+ ### Ottoman text:
17
+ {text_input}
18
+
19
+ ### English text:
20
+ """
21
+
22
+ try:
23
+ # Assuming `client` is your pre-defined translation model client
24
+ result = client.generate(
25
+ control_prompt,
26
+ adapter_id="gemma-2-9b/1",
27
+ max_new_tokens=512,
28
+ temperature=0.7,
29
+ top_p=0.95,
30
+ top_k=50
31
+ ).generated_text
32
 
33
+ return f"{result}"
34
+ except Exception as e:
35
 
36
+ return "Maalesef şuanda sunucu meşgul, lütfen biraz sonra bir daha deneyin!"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
 
38
  custom_css = """
39
  <style>