Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -67,10 +67,10 @@ def process_image(
|
|
| 67 |
with tempfile.NamedTemporaryFile(suffix=".png", delete=False) as temp_file:
|
| 68 |
resized_image.save(temp_file.name)
|
| 69 |
image_path = temp_file.name
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
|
| 75 |
try:
|
| 76 |
if model_choice == "Stable Diffusion":
|
|
@@ -99,6 +99,10 @@ def process_image(
|
|
| 99 |
|
| 100 |
elif model_choice == "Kolors":
|
| 101 |
client = Client("multimodalart/Kolors-IPAdapter", hf_token=api_key)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
result = client.predict(
|
| 103 |
prompt=prompt_kolors,
|
| 104 |
ip_adapter_image=handle_file(image_path),
|
|
|
|
| 67 |
with tempfile.NamedTemporaryFile(suffix=".png", delete=False) as temp_file:
|
| 68 |
resized_image.save(temp_file.name)
|
| 69 |
image_path = temp_file.name
|
| 70 |
+
if model_choice != "Kolors":
|
| 71 |
+
language = detect(prompt)
|
| 72 |
+
if language != 'en':
|
| 73 |
+
prompt = GoogleTranslator(source=language, target='en').translate(prompt)
|
| 74 |
|
| 75 |
try:
|
| 76 |
if model_choice == "Stable Diffusion":
|
|
|
|
| 99 |
|
| 100 |
elif model_choice == "Kolors":
|
| 101 |
client = Client("multimodalart/Kolors-IPAdapter", hf_token=api_key)
|
| 102 |
+
language = detect(prompt_kolors)
|
| 103 |
+
if language != 'en':
|
| 104 |
+
prompt_kolors = GoogleTranslator(source=language, target='en').translate(prompt_kolors)
|
| 105 |
+
|
| 106 |
result = client.predict(
|
| 107 |
prompt=prompt_kolors,
|
| 108 |
ip_adapter_image=handle_file(image_path),
|