visakh7843 commited on
Commit
c9dbbbe
1 Parent(s): 7f54642

New UI with 2 models

Browse files
Files changed (2) hide show
  1. app.py +55 -12
  2. app2.py +0 -69
app.py CHANGED
@@ -1,18 +1,61 @@
1
- from music import music_gen
 
 
2
  import gradio as gr
3
  import os
4
- from music import GlobalUIGallery
 
5
  keysignature = ["C","G","D","No selection"]
6
  difficulty = ["beginner","intermediate","expert"]
7
- timesignature = ['3/4','4/4','1/8']
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
- output = gr.Gallery() if GlobalUIGallery else "image"
 
 
 
 
 
 
 
 
10
 
11
- interface = gr.Interface(fn = music_gen,
12
- inputs=[gr.Radio(difficulty,label="Difficulty"),
13
- gr.Radio(timesignature,label="Time Signature"),
14
- gr.Dropdown(keysignature,label="Key Signature")],
15
- outputs = [gr.Gallery(label="Sheet Music"),gr.Audio(label="Audio")],
16
- title="Sheet Music Generation for Sight-Reading",
17
- description="TO be added")
18
- interface.launch(inline=False)
 
1
+ from matplotlib.pyplot import title
2
+ from yaml import Mark
3
+ from music import music_gen #Funtion to generate music based on ABC files
4
  import gradio as gr
5
  import os
6
+ from MC.markov_chain import main_markov #Function to generate music based on midi files
7
+
8
  keysignature = ["C","G","D","No selection"]
9
  difficulty = ["beginner","intermediate","expert"]
10
+ timesignature = ['3/4','4/4','1/8','6/8']
11
+
12
+ # output = gr.Gallery() if GlobalUIGallery else "image"
13
+
14
+ # interface = gr.Interface(fn = music_gen,
15
+ # inputs=[gr.Radio(difficulty,label="Difficulty"),
16
+ # gr.Radio(timesignature,label="Time Signature"),
17
+ # gr.Dropdown(keysignature,label="Key Signature")],
18
+ # outputs = [gr.Gallery(label="Sheet Music"),gr.Audio(label="Audio")],
19
+ # title="Sheet Music Generation for Sight-Reading",
20
+ # description="TO be added")
21
+ # interface.launch(inline=False)
22
+
23
+ with gr.Blocks() as demo:
24
+
25
+ gr.Markdown("""
26
+ ## Sheet Music Generation for Sight-Reading
27
+ """)
28
+ with gr.Tabs():
29
+ with gr.TabItem("ABC Model"):
30
+ gr.Markdown("ABC Model discription")
31
+ with gr.Row():
32
+ with gr.Column():
33
+ difficulty_input_abc = gr.Radio(difficulty,label="Difficulty") #input
34
+ time_sig_input_abc = gr.Radio(timesignature,label="Time Signature") #input
35
+ key_sig_input_abc = gr.Dropdown(keysignature,label="Key Signature") #input
36
+ with gr.Row():
37
+ abc_button = gr.Button("Create Music!!") #Submit
38
+
39
+ with gr.Column():
40
+ output_gallery_abc = gr.Gallery(label="Sheet Music")
41
+ output_audio_abc = gr.Audio(label="Audio")
42
+ with gr.TabItem("Midi Model"):
43
+ gr.Markdown("ABC Model discription")
44
+ with gr.Row():
45
+ with gr.Column():
46
+ # difficulty_input_midi = gr.Radio(difficulty,label="Difficulty") #input
47
+ time_sig_input_midi = gr.Radio(timesignature,label="Time Signature") #input
48
+ # key_sig_input_midi = gr.Dropdown(keysignature,label="Key Signature") #input
49
+ with gr.Row():
50
+ midi_button = gr.Button("Create Music!!") #Submit
51
 
52
+ with gr.Column():
53
+ output_gallery_midi = gr.Gallery(label="Sheet Music")
54
+ output_audio_midi = gr.Audio(label="Audio")
55
+
56
+ abc_button.click(music_gen, inputs=[difficulty_input_abc,time_sig_input_abc,key_sig_input_abc], outputs=[output_gallery_abc,output_audio_abc])
57
+ midi_button.click(main_markov, inputs= time_sig_input_midi, outputs=[output_gallery_midi,output_audio_midi])
58
+
59
+ if __name__ == "__main__":
60
+ demo.launch()
61
 
 
 
 
 
 
 
 
 
app2.py DELETED
@@ -1,69 +0,0 @@
1
- from matplotlib.pyplot import title
2
- from yaml import Mark
3
- from music import music_gen #Funtion to generate music based on ABC files
4
- import gradio as gr
5
- import os
6
- from MC.markov_chain import main_markov #Function to generate music based on midi files
7
-
8
- keysignature = ["C","G","D","No selection"]
9
- difficulty = ["beginner","intermediate","expert"]
10
- timesignature = ['3/4','4/4','1/8','6/8']
11
-
12
- # output = gr.Gallery() if GlobalUIGallery else "image"
13
-
14
- # interface = gr.Interface(fn = music_gen,
15
- # inputs=[gr.Radio(difficulty,label="Difficulty"),
16
- # gr.Radio(timesignature,label="Time Signature"),
17
- # gr.Dropdown(keysignature,label="Key Signature")],
18
- # outputs = [gr.Gallery(label="Sheet Music"),gr.Audio(label="Audio")],
19
- # title="Sheet Music Generation for Sight-Reading",
20
- # description="TO be added")
21
- # interface.launch(inline=False)
22
-
23
- import numpy as np
24
-
25
- def flip_text(x):
26
- return x[::-1]
27
-
28
- def flip_image(x):
29
- return np.fliplr(x)
30
-
31
- with gr.Blocks() as demo:
32
-
33
- gr.Markdown("""
34
- ## Sheet Music Generation for Sight-Reading
35
- """)
36
- with gr.Tabs():
37
- with gr.TabItem("ABC Model"):
38
- gr.Markdown("ABC Model discription")
39
- with gr.Row():
40
- with gr.Column():
41
- difficulty_input_abc = gr.Radio(difficulty,label="Difficulty") #input
42
- time_sig_input_abc = gr.Radio(timesignature,label="Time Signature") #input
43
- key_sig_input_abc = gr.Dropdown(keysignature,label="Key Signature") #input
44
- with gr.Row():
45
- abc_button = gr.Button("Create Music!!") #Submit
46
-
47
- with gr.Column():
48
- output_gallery_abc = gr.Gallery(label="Sheet Music")
49
- output_audio_abc = gr.Audio(label="Audio")
50
- with gr.TabItem("Midi Model"):
51
- gr.Markdown("ABC Model discription")
52
- with gr.Row():
53
- with gr.Column():
54
- # difficulty_input_midi = gr.Radio(difficulty,label="Difficulty") #input
55
- time_sig_input_midi = gr.Radio(timesignature,label="Time Signature") #input
56
- # key_sig_input_midi = gr.Dropdown(keysignature,label="Key Signature") #input
57
- with gr.Row():
58
- midi_button = gr.Button("Create Music!!") #Submit
59
-
60
- with gr.Column():
61
- output_gallery_midi = gr.Gallery(label="Sheet Music")
62
- output_audio_midi = gr.Audio(label="Audio")
63
-
64
- abc_button.click(music_gen, inputs=[difficulty_input_abc,time_sig_input_abc,key_sig_input_abc], outputs=[output_gallery_abc,output_audio_abc])
65
- midi_button.click(main_markov, inputs= time_sig_input_midi, outputs=[output_gallery_midi,output_audio_midi])
66
-
67
- if __name__ == "__main__":
68
- demo.launch()
69
-