Spaces:
Running
Running
test
Browse files
app.py
CHANGED
@@ -11,15 +11,14 @@ openai.api_key = os.environ.get("OPENAI_API_KEY")
|
|
11 |
|
12 |
# sample data
|
13 |
markdown_table_sample = """
|
14 |
-
| | 1 | 2 | 3 | 4 |
|
15 |
-
|
16 |
-
|
|
17 |
-
|
|
18 |
-
|
|
19 |
-
|
|
20 |
-
|
|
21 |
-
|
|
22 |
-
| HT | x | | | x |
|
23 |
"""
|
24 |
|
25 |
markdown_table_sample2 = """
|
@@ -89,9 +88,9 @@ def get_answer(question):
|
|
89 |
response = openai.ChatCompletion.create(
|
90 |
model="gpt-3.5-turbo",
|
91 |
messages=[
|
92 |
-
{"role": "system", "content": "You are a rhythm generator.
|
93 |
-
{"role": "user", "content": "Please generate a rhythm pattern in a Markdown table. You use the following drums. Kick drum:BD, Snare drum:SD, Closed-hihat:CH, Open-hihat:OH, Low-tom:LT, Mid-tom:MT, High-tom:HT. use 'x' for an accented beat, 'o' for a weak beat."},
|
94 |
-
{"role": "assistant", "content":
|
95 |
# {"role": "user", "content": "Please generate a rhythm pattern. The resolution is the fourth note. You use the following drums. Kick drum:BD, Snare drum:SD, Closed-hihat:CH, Open-hihat:OH, Low-tom:LT, Mid-tom:MT, High-tom:HT. use 'x' for an accented beat, 'o' for a weak beat. You need to write the time resolution first."},
|
96 |
# {"role": "assistant", "content": markdown_table_sample},
|
97 |
{"role": "user", "content": question}
|
@@ -115,7 +114,7 @@ def generate_rhythm(query, state):
|
|
115 |
# resolution = int(resolution_text)
|
116 |
# except:
|
117 |
# resolution = 8 # default
|
118 |
-
resolution =
|
119 |
|
120 |
# Extract rhythm table
|
121 |
table = "|" + "|".join(text_output.split('|')[1:-1]) + "|"
|
|
|
11 |
|
12 |
# sample data
|
13 |
markdown_table_sample = """
|
14 |
+
| | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|
15 |
+
| BD | x | | x | | | | x | |
|
16 |
+
| SD | | | | x | | | | x |
|
17 |
+
| CH | x | | x | | x | | x | |
|
18 |
+
| OH | | | | x | | | x | |
|
19 |
+
| LT | | | | | | x | | |
|
20 |
+
| MT | | x | | | x | | | |
|
21 |
+
| HT | x | | | x | | | | |
|
|
|
22 |
"""
|
23 |
|
24 |
markdown_table_sample2 = """
|
|
|
88 |
response = openai.ChatCompletion.create(
|
89 |
model="gpt-3.5-turbo",
|
90 |
messages=[
|
91 |
+
{"role": "system", "content": "You are a rhythm generator. "},
|
92 |
+
{"role": "user", "content": "Please generate a rhythm pattern in a Markdown table. Time resolution is the 8th note. You use the following drums. Kick drum:BD, Snare drum:SD, Closed-hihat:CH, Open-hihat:OH, Low-tom:LT, Mid-tom:MT, High-tom:HT. use 'x' for an accented beat, 'o' for a weak beat."},
|
93 |
+
{"role": "assistant", "content": markdown_table_sample},
|
94 |
# {"role": "user", "content": "Please generate a rhythm pattern. The resolution is the fourth note. You use the following drums. Kick drum:BD, Snare drum:SD, Closed-hihat:CH, Open-hihat:OH, Low-tom:LT, Mid-tom:MT, High-tom:HT. use 'x' for an accented beat, 'o' for a weak beat. You need to write the time resolution first."},
|
95 |
# {"role": "assistant", "content": markdown_table_sample},
|
96 |
{"role": "user", "content": question}
|
|
|
114 |
# resolution = int(resolution_text)
|
115 |
# except:
|
116 |
# resolution = 8 # default
|
117 |
+
resolution = 8 # default
|
118 |
|
119 |
# Extract rhythm table
|
120 |
table = "|" + "|".join(text_output.split('|')[1:-1]) + "|"
|