Spaces:
Runtime error
Runtime error
raheemuddin
commited on
Commit
•
8fefe8c
1
Parent(s):
5f1c1e6
Update app.py
Browse files
app.py
CHANGED
@@ -3,11 +3,12 @@ import boto3
|
|
3 |
import os
|
4 |
|
5 |
hf_token = os.environ.get("HF_TOKEN")
|
6 |
-
|
|
|
7 |
|
8 |
def detect_language(text):
|
9 |
# Initialize the Comprehend client
|
10 |
-
comprehend = boto3.client('comprehend'
|
11 |
# Call DetectDominantLanguage API
|
12 |
response = comprehend.detect_dominant_language(Text=text)
|
13 |
# Extract the detected language
|
@@ -18,7 +19,7 @@ def translate_and_predict(text):
|
|
18 |
"""Translates text and generates an image using Stable Diffusion."""
|
19 |
source_language_code=detect_language(text)
|
20 |
# Translate input text
|
21 |
-
translate = boto3.client('translate'
|
22 |
target_language_code="en"
|
23 |
print("source_language_code:" , source_language_code)
|
24 |
translation_result = translate.translate_text(Text=text, SourceLanguageCode=source_language_code, TargetLanguageCode=target_language_code)
|
|
|
3 |
import os
|
4 |
|
5 |
hf_token = os.environ.get("HF_TOKEN")
|
6 |
+
tasomi_model = os.environ.get("TASOMI_MODEL")
|
7 |
+
m=gr.load(tasomi_model, src="models",hf_token=hf_token)
|
8 |
|
9 |
def detect_language(text):
|
10 |
# Initialize the Comprehend client
|
11 |
+
comprehend = boto3.client('comprehend')
|
12 |
# Call DetectDominantLanguage API
|
13 |
response = comprehend.detect_dominant_language(Text=text)
|
14 |
# Extract the detected language
|
|
|
19 |
"""Translates text and generates an image using Stable Diffusion."""
|
20 |
source_language_code=detect_language(text)
|
21 |
# Translate input text
|
22 |
+
translate = boto3.client('translate')
|
23 |
target_language_code="en"
|
24 |
print("source_language_code:" , source_language_code)
|
25 |
translation_result = translate.translate_text(Text=text, SourceLanguageCode=source_language_code, TargetLanguageCode=target_language_code)
|