Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -11,10 +11,6 @@ from PIL import Image
|
|
11 |
from diffusers.utils import load_image
|
12 |
from diffusers.utils import export_to_video
|
13 |
import random
|
14 |
-
from transformers import pipeline
|
15 |
-
|
16 |
-
# Translation model load
|
17 |
-
translator = pipeline("translation", model="Helsinki-NLP/opus-mt-ko-en")
|
18 |
|
19 |
# English menu labels
|
20 |
english_labels = {
|
@@ -68,10 +64,9 @@ def convert_to_centered_scale(num):
|
|
68 |
end = num // 2
|
69 |
return tuple(range(start, end + 1))
|
70 |
|
71 |
-
def
|
72 |
-
|
73 |
-
|
74 |
-
return text
|
75 |
|
76 |
@spaces.GPU(duration=85)
|
77 |
def generate(prompt,
|
@@ -89,10 +84,10 @@ def generate(prompt,
|
|
89 |
avg_diff_x=None,
|
90 |
total_images=[],
|
91 |
gradio_progress=gr.Progress()):
|
92 |
-
#
|
93 |
-
prompt
|
94 |
-
|
95 |
-
|
96 |
print(f"Prompt: {prompt}, ← {concept_2}, {concept_1} ➡️ . scale {scale}, interm steps {interm_steps}")
|
97 |
slider_x = [concept_2, concept_1]
|
98 |
if randomize_seed:
|
@@ -315,7 +310,7 @@ with gr.Blocks(css=css, title="Time Stream") as demo:
|
|
315 |
label=english_labels["From 1st to 2nd direction"]
|
316 |
)
|
317 |
|
318 |
-
# Examples
|
319 |
gr.Examples(
|
320 |
examples=examples,
|
321 |
inputs=[prompt, concept_1, concept_2, x]
|
@@ -352,4 +347,4 @@ with gr.Blocks(css=css, title="Time Stream") as demo:
|
|
352 |
)
|
353 |
|
354 |
if __name__ == "__main__":
|
355 |
-
demo.launch()
|
|
|
11 |
from diffusers.utils import load_image
|
12 |
from diffusers.utils import export_to_video
|
13 |
import random
|
|
|
|
|
|
|
|
|
14 |
|
15 |
# English menu labels
|
16 |
english_labels = {
|
|
|
64 |
end = num // 2
|
65 |
return tuple(range(start, end + 1))
|
66 |
|
67 |
+
def is_korean(text):
|
68 |
+
"""한글 포함 여부 확인"""
|
69 |
+
return any('\u3131' <= char <= '\u3163' or '\uac00' <= char <= '\ud7a3' for char in text)
|
|
|
70 |
|
71 |
@spaces.GPU(duration=85)
|
72 |
def generate(prompt,
|
|
|
84 |
avg_diff_x=None,
|
85 |
total_images=[],
|
86 |
gradio_progress=gr.Progress()):
|
87 |
+
# Check if there is Korean text and warn if so
|
88 |
+
if is_korean(prompt) or is_korean(concept_1) or is_korean(concept_2):
|
89 |
+
print("Korean text detected. The model will use it directly without translation.")
|
90 |
+
|
91 |
print(f"Prompt: {prompt}, ← {concept_2}, {concept_1} ➡️ . scale {scale}, interm steps {interm_steps}")
|
92 |
slider_x = [concept_2, concept_1]
|
93 |
if randomize_seed:
|
|
|
310 |
label=english_labels["From 1st to 2nd direction"]
|
311 |
)
|
312 |
|
313 |
+
# Examples
|
314 |
gr.Examples(
|
315 |
examples=examples,
|
316 |
inputs=[prompt, concept_1, concept_2, x]
|
|
|
347 |
)
|
348 |
|
349 |
if __name__ == "__main__":
|
350 |
+
demo.launch()
|