Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,24 +19,29 @@ def process_text(text,temperature):
|
|
| 19 |
|
| 20 |
### English text:
|
| 21 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
print("r:", result)
|
| 35 |
-
|
| 36 |
-
return f"{result}"
|
| 37 |
-
except Exception as e:
|
| 38 |
-
|
| 39 |
-
return "Maalesef şuanda sunucu meşgul, lütfen biraz sonra bir daha deneyin!"
|
| 40 |
|
| 41 |
|
| 42 |
# Create the Gradio interface
|
|
|
|
| 19 |
|
| 20 |
### English text:
|
| 21 |
"""
|
| 22 |
+
|
| 23 |
+
for i in range(2):
|
| 24 |
+
try:
|
| 25 |
+
# Assuming `client` is your pre-defined translation model client
|
| 26 |
+
result = client.generate(
|
| 27 |
+
control_prompt,
|
| 28 |
+
adapter_id="gemma-2-9b/1",
|
| 29 |
+
max_new_tokens=256,
|
| 30 |
+
temperature=0.7,
|
| 31 |
+
top_p=0.95,
|
| 32 |
+
top_k=50
|
| 33 |
+
).generated_text
|
| 34 |
|
| 35 |
+
print("r:", result)
|
| 36 |
+
|
| 37 |
+
result = result.split("###")[0]
|
| 38 |
+
|
| 39 |
+
# Stripping any leading/trailing whitespace
|
| 40 |
+
result = result.strip()
|
| 41 |
+
|
| 42 |
+
return f"{result}"
|
| 43 |
+
except Exception as e:
|
| 44 |
+
return "Maalesef şuanda sunucu meşgul, lütfen biraz sonra bir daha deneyin!"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
|
| 47 |
# Create the Gradio interface
|