Spaces:
Running
Running
format
Browse files
app.py
CHANGED
@@ -92,10 +92,10 @@ def get_answer(question):
|
|
92 |
model="gpt-3.5-turbo",
|
93 |
messages=[
|
94 |
{"role": "system", "content": "You are a rhythm generator."},
|
95 |
-
{"role": "user", "content": "Please generate a rhythm pattern. 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_sample2},
|
97 |
-
{"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."},
|
98 |
-
{"role": "assistant", "content": markdown_table_sample},
|
99 |
{"role": "user", "content": question}
|
100 |
]
|
101 |
)
|
@@ -136,8 +136,11 @@ def on_token_change(user_token, state):
|
|
136 |
|
137 |
with gr.Blocks() as demo:
|
138 |
state = gr.State({"gen_count": 0, "user_token":""})
|
139 |
-
|
140 |
-
|
|
|
|
|
|
|
141 |
with gr.Row():
|
142 |
with gr.Column():
|
143 |
inp = gr.Textbox(placeholder="Give me a Hiphop rhythm pattern with some reggae twist!")
|
@@ -145,9 +148,10 @@ with gr.Blocks() as demo:
|
|
145 |
with gr.Column():
|
146 |
out_audio = gr.Audio()
|
147 |
out_text = gr.Textbox(placeholder="ChatGPT output")
|
148 |
-
with gr.
|
149 |
-
gr.
|
150 |
-
|
|
|
151 |
btn.click(fn=generate_rhythm, inputs=[inp, state], outputs=[out_audio, out_text])
|
152 |
user_token.change(on_token_change, inputs=[user_token, state], outputs=[state])
|
153 |
demo.launch()
|
|
|
92 |
model="gpt-3.5-turbo",
|
93 |
messages=[
|
94 |
{"role": "system", "content": "You are a rhythm generator."},
|
95 |
+
{"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. You need to write the time resolution first."},
|
96 |
{"role": "assistant", "content": markdown_table_sample2},
|
97 |
+
# {"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."},
|
98 |
+
# {"role": "assistant", "content": markdown_table_sample},
|
99 |
{"role": "user", "content": question}
|
100 |
]
|
101 |
)
|
|
|
136 |
|
137 |
with gr.Blocks() as demo:
|
138 |
state = gr.State({"gen_count": 0, "user_token":""})
|
139 |
+
with gr.Row():
|
140 |
+
with gr.Column():
|
141 |
+
# gr.Markdown("Ask ChatGPT to generate rhythm patterns")
|
142 |
+
gr.Markdown("***Hey TR-ChatGPT, give me a drum pattern!***")
|
143 |
+
gr.Markdown("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. ", elem_id="label")
|
144 |
with gr.Row():
|
145 |
with gr.Column():
|
146 |
inp = gr.Textbox(placeholder="Give me a Hiphop rhythm pattern with some reggae twist!")
|
|
|
148 |
with gr.Column():
|
149 |
out_audio = gr.Audio()
|
150 |
out_text = gr.Textbox(placeholder="ChatGPT output")
|
151 |
+
with gr.Row():
|
152 |
+
with gr.Column():
|
153 |
+
gr.Markdown("Enter your own OpenAI API Key to try out more than 5 times. You can get it [here](https://platform.openai.com/account/api-keys).")
|
154 |
+
user_token = gr.Textbox(placeholder="OpenAI API Key", type="password", show_label=False)
|
155 |
btn.click(fn=generate_rhythm, inputs=[inp, state], outputs=[out_audio, out_text])
|
156 |
user_token.change(on_token_change, inputs=[user_token, state], outputs=[state])
|
157 |
demo.launch()
|