Spaces:
Runtime error
Runtime error
Dhruv Diddi
commited on
Commit
·
fc97eea
1
Parent(s):
956a40b
fix: update translate
Browse files- app.py +2 -2
- translate.py +10 -0
app.py
CHANGED
|
@@ -17,7 +17,7 @@ pipe = StableDiffusionPipeline.from_pretrained(model_id, use_auth_token=auth_tok
|
|
| 17 |
pipe = pipe.to(device)
|
| 18 |
|
| 19 |
def infer(prompt, samples, steps, scale, seed):
|
| 20 |
-
lang_detected = lt.detect(prompt)[
|
| 21 |
print(lang_detected)
|
| 22 |
translated = lt.translate(prompt, lang_detected, "en")
|
| 23 |
print(translated)
|
|
@@ -86,4 +86,4 @@ with block:
|
|
| 86 |
text,
|
| 87 |
)
|
| 88 |
|
| 89 |
-
block.launch()
|
|
|
|
| 17 |
pipe = pipe.to(device)
|
| 18 |
|
| 19 |
def infer(prompt, samples, steps, scale, seed):
|
| 20 |
+
lang_detected = lt.detect(prompt)[0]['language']
|
| 21 |
print(lang_detected)
|
| 22 |
translated = lt.translate(prompt, lang_detected, "en")
|
| 23 |
print(translated)
|
|
|
|
| 86 |
text,
|
| 87 |
)
|
| 88 |
|
| 89 |
+
block.launch()
|
translate.py
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from libretranslatepy import LibreTranslateAPI
|
| 2 |
+
|
| 3 |
+
lt = LibreTranslateAPI("https://translate.argosopentech.com/")
|
| 4 |
+
|
| 5 |
+
attempt_input = input("Enter input:")
|
| 6 |
+
detected = lt.detect(attempt_input)[0]['language']
|
| 7 |
+
print(detected)
|
| 8 |
+
print(lt.translate(attempt_input, detected, "en"))
|
| 9 |
+
|
| 10 |
+
|