Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -5,17 +5,21 @@ from gradio_client import Client # ๊ฐ์ : gradio_client ๋ผ์ด๋ธ๋ฌ๋ฆฌ๊ฐ ์ฌ
|
|
5 |
# ์ด๋ฏธ์ง ์ธ์ ํ์ดํ๋ผ์ธ ๋ก๋
|
6 |
image_model = pipeline("image-classification", model="google/vit-base-patch16-224")
|
7 |
|
8 |
-
def generate_music(
|
9 |
# ๊ธฐ๋ณธ ํ๋กฌํํธ ์ค์
|
10 |
base_prompt = "The rnb beat of 85BPM drums. playing Violin."
|
11 |
-
# ์ฌ๋ฌผ ์ธ์ ๊ฒฐ๊ณผ๋ฅผ ๊ธฐ๋ณธ ํ๋กฌํํธ์ ์ถ๊ฐ
|
12 |
-
full_prompt = f"{base_prompt} for a {object_detected}"
|
13 |
# ๋ถ์ ์ ์ธ ํ๋กฌํํธ ์ถ๊ฐ
|
14 |
negative_prompt = "Low quality."
|
|
|
|
|
|
|
|
|
15 |
|
16 |
# ์์
์์ฑ API ํธ์ถ
|
17 |
client = Client("https://haoheliu-audioldm2-text2audio-text2music.hf.space/")
|
18 |
result = client.predict(
|
|
|
|
|
19 |
prompt,
|
20 |
prompt, # ์์ฑ ์์ฑ์ ์ฌ์ฉ๋ ํ๋กฌํํธ
|
21 |
5, # ์์
์ ๊ธธ์ด (์ด)
|
|
|
5 |
# ์ด๋ฏธ์ง ์ธ์ ํ์ดํ๋ผ์ธ ๋ก๋
|
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 |
result = client.predict(
|
21 |
+
prompt=full_prompt, # ๊ธฐ๋ณธ ํ๋กฌํํธ
|
22 |
+
negative_prompt=negative_prompt, # ๋ถ์ ์ ์ธ ํ๋กฌํํธ
|
23 |
prompt,
|
24 |
prompt, # ์์ฑ ์์ฑ์ ์ฌ์ฉ๋ ํ๋กฌํํธ
|
25 |
5, # ์์
์ ๊ธธ์ด (์ด)
|