Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -6,27 +6,19 @@ from gradio_client import Client # ๊ฐ์ : gradio_client ๋ผ์ด๋ธ๋ฌ๋ฆฌ๊ฐ ์ฌ
|
|
6 |
image_model = pipeline("image-classification", model="google/vit-base-patch16-224")
|
7 |
|
8 |
def generate_music(image_classification_result):
|
9 |
-
# ๊ธฐ๋ณธ ํ๋กฌํํธ ์ค์
|
10 |
-
base_prompt = "The rnb beat of 85BPM drums. playing Violin."
|
11 |
-
# ๋ถ์ ์ ์ธ ํ๋กฌํํธ ์ถ๊ฐ
|
12 |
-
negative_prompt = "Low quality."
|
13 |
-
|
14 |
-
# ์ด๋ฏธ์ง ๋ถ๋ฅ ๊ฒฐ๊ณผ๋ฅผ ํฌํจํ ์ ์ฒด ํ๋กฌํํธ ์์ฑ
|
15 |
-
full_prompt = f"{base_prompt} Inspired by: {image_classification_result}."
|
16 |
-
|
17 |
-
|
18 |
# ์์
์์ฑ API ํธ์ถ
|
19 |
client = Client("https://haoheliu-audioldm2-text2audio-text2music.hf.space/")
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
num_waveforms=1, # ์์ฑํ waveform์ ์, ํค์๋ ์ธ์๋ก ๋ณ๊ฒฝ
|
27 |
fn_index=1 # ํจ์ ์ธ๋ฑ์ค, ์ด๋ฏธ ํค์๋ ์ธ์๋ก ๋์ด ์์
|
28 |
)
|
29 |
|
|
|
|
|
30 |
# API ํธ์ถ ๊ฒฐ๊ณผ ์ฒ๋ฆฌ
|
31 |
return result
|
32 |
|
|
|
6 |
image_model = pipeline("image-classification", model="google/vit-base-patch16-224")
|
7 |
|
8 |
def generate_music(image_classification_result):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
# ์์
์์ฑ API ํธ์ถ
|
10 |
client = Client("https://haoheliu-audioldm2-text2audio-text2music.hf.space/")
|
11 |
+
"The rnb beat of 85BPM drums. playing Violin."
|
12 |
+
"Low quality."
|
13 |
+
5, # ์์
์ ๊ธธ์ด (์ด), ํค์๋ ์ธ์๋ก ๋ณ๊ฒฝ
|
14 |
+
0, # ๊ฐ์ด๋์ค ์ค์ผ์ผ, ํค์๋ ์ธ์๋ก ๋ณ๊ฒฝ
|
15 |
+
5, # ์๋ ๊ฐ, ํค์๋ ์ธ์๋ก ๋ณ๊ฒฝ
|
16 |
+
1, # ์์ฑํ waveform์ ์, ํค์๋ ์ธ์๋ก ๋ณ๊ฒฝ
|
|
|
17 |
fn_index=1 # ํจ์ ์ธ๋ฑ์ค, ์ด๋ฏธ ํค์๋ ์ธ์๋ก ๋์ด ์์
|
18 |
)
|
19 |
|
20 |
+
# ์ด๋ฏธ์ง ๋ถ๋ฅ ๊ฒฐ๊ณผ๋ฅผ ํฌํจํ ์ ์ฒด ํ๋กฌํํธ ์์ฑ
|
21 |
+
full_prompt = f"{base_prompt} Inspired by: {image_classification_result}."
|
22 |
# API ํธ์ถ ๊ฒฐ๊ณผ ์ฒ๋ฆฌ
|
23 |
return result
|
24 |
|