Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,25 +1,25 @@
|
|
1 |
import gradio as gr
|
2 |
-
from
|
3 |
|
4 |
-
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
labels = [result['label'] for result in results]
|
12 |
-
return ", ".join(labels)
|
13 |
-
|
14 |
-
# Gradio ์ธํฐํ์ด์ค ์ ์, `source` ์ธ์๋ฅผ ์ ๊ฑฐ
|
15 |
-
iface = gr.Interface(
|
16 |
-
fn=process_video,
|
17 |
-
inputs=gr.Video(streaming=True),
|
18 |
outputs="text",
|
19 |
-
title="
|
20 |
-
description="
|
21 |
)
|
22 |
|
23 |
-
#
|
24 |
-
|
25 |
-
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
from googletrans import Translator
|
3 |
|
4 |
+
def translate_to_english_keywords(text):
|
5 |
+
# Translator ๊ฐ์ฒด ์์ฑ
|
6 |
+
translator = Translator()
|
7 |
+
|
8 |
+
# ์
๋ ฅ๋ฐ์ ํ๊ธ ๋ฌธ์ฅ์ ์์ด๋ก ๋ฒ์ญ
|
9 |
+
translated_text = translator.translate(text, src='ko', dest='en')
|
10 |
+
|
11 |
+
# ๋ฒ์ญ๋ ์์ด ๋ฌธ์ฅ์์ ํค์๋ ์ถ์ถ(์ฌ๊ธฐ์๋ ๊ฐ๋จํ ์ ์ฒด ๋ฒ์ญ๋ ๋ฌธ์ฅ์ ๋ฐํ)
|
12 |
+
# ์ค์ ํ์ฉ ์์๋ ํค์๋ ์ถ์ถ ๋ก์ง์ ์ถ๊ฐํ ์ ์์ต๋๋ค.
|
13 |
+
return translated_text.text
|
14 |
|
15 |
+
# Gradio ์ธํฐํ์ด์ค ์ ์
|
16 |
+
interface = gr.Interface(
|
17 |
+
fn=translate_to_english_keywords,
|
18 |
+
inputs=gr.inputs.Textbox(lines=2, placeholder="ํ๊ธ ๋ฌธ์ฅ์ ์
๋ ฅํ์ธ์..."),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
outputs="text",
|
20 |
+
title="ํ๊ธ ๋ฌธ์ฅ์ ์์ด ํค์๋๋ก ๋ฒ์ญ",
|
21 |
+
description="ํ๊ธ ๋ฌธ์ฅ์ ์
๋ ฅํ๋ฉด, ๊ทธ ์๋ฏธ๊ฐ ํฌํจ๋ ๊ฐ๋ตํ๊ณ ํจ์ถ์ ์ธ ์์ด๋ก ์ถ๋ ฅํฉ๋๋ค."
|
22 |
)
|
23 |
|
24 |
+
# ์ ํ๋ฆฌ์ผ์ด์
์คํ
|
25 |
+
interface.launch()
|
|