Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,21 +1,20 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
4 |
-
# ๋น์ ์ธ์
|
5 |
-
vision_pipeline = pipeline(task="image-classification")
|
6 |
|
7 |
def process_video(video):
|
8 |
-
# ๋น๋์ค ํ๋ ์์
|
9 |
-
# ์ฌ๊ธฐ์๋
|
10 |
-
# ์ค์ ์ ํ๋ฆฌ์ผ์ด์
์์๋ ๋น๋์ค์ ๋ชจ๋ ํ๋ ์ ๋๋ ํน์ ์ธํฐ๋ฒ๋ก ํ๋ ์์ ์ฒ๋ฆฌํ ์ ์์ต๋๋ค.
|
11 |
results = vision_pipeline(video)
|
12 |
labels = [result['label'] for result in results]
|
13 |
return ", ".join(labels)
|
14 |
|
15 |
-
# Gradio ์ธํฐํ์ด์ค
|
16 |
iface = gr.Interface(
|
17 |
fn=process_video,
|
18 |
-
inputs=gr.Video(
|
19 |
outputs="text",
|
20 |
title="์ค์๊ฐ ์น์บ ๋ชจ๋ํฐ๋ง๊ณผ ๋น์ ์ธ์",
|
21 |
description="์น์บ ์ ํตํด ์ค์๊ฐ์ผ๋ก ํ๋ฉด ๋ณํ๋ฅผ ๊ฐ์งํ๊ณ , ๋น์ ์ธ์ ๋ชจ๋ธ์ ์ ์ฉํ์ฌ ํ
์คํธ๋ก ์ถ๋ ฅํฉ๋๋ค."
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
4 |
+
# ๋น์ ์ธ์ ํ์ดํ๋ผ์ธ์ ๋ช
์์ ์ผ๋ก ๋ชจ๋ธ ์ด๋ฆ๊ณผ ํจ๊ป ์ด๊ธฐํ
|
5 |
+
vision_pipeline = pipeline(task="image-classification", model="google/vit-base-patch16-224")
|
6 |
|
7 |
def process_video(video):
|
8 |
+
# ๋น๋์ค ํ๋ ์์ ์ฒ๋ฆฌํ๋ ํจ์
|
9 |
+
# ์ฌ๊ธฐ์๋ ๋จ์ํ๋ฅผ ์ํด ๋น๋์ค ํ์ผ์ ์ฒซ ํ๋ ์๋ง ์ฒ๋ฆฌํฉ๋๋ค.
|
|
|
10 |
results = vision_pipeline(video)
|
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="์น์บ ์ ํตํด ์ค์๊ฐ์ผ๋ก ํ๋ฉด ๋ณํ๋ฅผ ๊ฐ์งํ๊ณ , ๋น์ ์ธ์ ๋ชจ๋ธ์ ์ ์ฉํ์ฌ ํ
์คํธ๋ก ์ถ๋ ฅํฉ๋๋ค."
|