ElectricAlexis commited on
Commit
7ff62d4
·
verified ·
1 Parent(s): 8e170be

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +71 -4
app.py CHANGED
@@ -1,5 +1,5 @@
1
- import spaces
2
- import zero
3
  import gradio as gr
4
  import sys
5
  import threading
@@ -15,6 +15,33 @@ from inference import inference_patch
15
  from convert import abc2xml, xml2, pdf2img
16
 
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  # Read prompt combinations
19
  with open('prompts.txt', 'r') as f:
20
  prompts = f.readlines()
@@ -143,7 +170,7 @@ def update_page(direction, data):
143
  return new_image, prev_btn_state, next_btn_state, data
144
 
145
 
146
- @spaces.GPU(duration=600)
147
  def generate_music(period, composer, instrumentation):
148
  """
149
  Must ensure each yield returns the same number of values.
@@ -324,10 +351,50 @@ button[size="sm"] {
324
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
325
  }
326
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
327
  """
328
 
329
  with gr.Blocks(css=css) as demo:
330
- gr.Markdown("## NotaGen")
331
 
332
  # For storing PDF page count, current page and other information
333
  pdf_state = gr.State()
 
1
+ # import spaces
2
+ # import zero
3
  import gradio as gr
4
  import sys
5
  import threading
 
15
  from convert import abc2xml, xml2, pdf2img
16
 
17
 
18
+ title_html = """
19
+ <div class="title-container">
20
+ <h1 class="title-text">NotaGen</h1> &nbsp;
21
+ <!-- ArXiv -->
22
+ <a href="https://arxiv.org/abs/2502.18008">
23
+ <img src="https://img.shields.io/badge/NotaGen_Paper-ArXiv-%23B31B1B?logo=arxiv&logoColor=white" alt="Paper">
24
+ </a>
25
+ &nbsp;
26
+ <!-- GitHub -->
27
+ <a href="https://github.com/ElectricAlexis/NotaGen">
28
+ <img src="https://img.shields.io/badge/NotaGen_Code-GitHub-%23181717?logo=github&logoColor=white" alt="GitHub">
29
+ </a>
30
+ &nbsp;
31
+ <!-- HuggingFace -->
32
+ <a href="https://huggingface.co/ElectricAlexis/NotaGen">
33
+ <img src="https://img.shields.io/badge/NotaGen_Weights-HuggingFace-%23FFD21F?logo=huggingface&logoColor=white" alt="Weights">
34
+ </a>
35
+ &nbsp;
36
+ <!-- Web Demo -->
37
+ <a href="https://electricalexis.github.io/notagen-demo/">
38
+ <img src="https://img.shields.io/badge/NotaGen_Demo-Web-%23007ACC?logo=google-chrome&logoColor=white" alt="Demo">
39
+ </a>
40
+ </div>
41
+ <bp>
42
+ <p style="font-size: 1.2em;">NotaGen is a model for generating sheet music in ABC notation format. Select a period, composer, and instrumentation to generate classical-style music!</p>
43
+ """
44
+
45
  # Read prompt combinations
46
  with open('prompts.txt', 'r') as f:
47
  prompts = f.readlines()
 
170
  return new_image, prev_btn_state, next_btn_state, data
171
 
172
 
173
+ # @spaces.GPU(duration=600)
174
  def generate_music(period, composer, instrumentation):
175
  """
176
  Must ensure each yield returns the same number of values.
 
351
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
352
  }
353
 
354
+ /* Social icons styling */
355
+ .title-container {
356
+ display: flex;
357
+ align-items: center;
358
+ gap: 15px;
359
+ margin-bottom: 10px;
360
+ }
361
+
362
+ .title-text {
363
+ margin: 0;
364
+ font-size: 1.8em;
365
+ }
366
+
367
+ .social-icons {
368
+ display: flex;
369
+ gap: 10px;
370
+ }
371
+
372
+ .social-icon {
373
+ display: inline-flex;
374
+ align-items: center;
375
+ justify-content: center;
376
+ width: 32px;
377
+ height: 32px;
378
+ border-radius: 50%;
379
+ background-color: #f5f5f5;
380
+ text-decoration: none;
381
+ transition: transform 0.2s, background-color 0.2s;
382
+ }
383
+
384
+ .social-icon:hover {
385
+ transform: scale(1.1);
386
+ background-color: #e0e0e0;
387
+ }
388
+
389
+ .social-icon img {
390
+ width: 20px;
391
+ height: 20px;
392
+ }
393
+
394
  """
395
 
396
  with gr.Blocks(css=css) as demo:
397
+ gr.HTML(title_html)
398
 
399
  # For storing PDF page count, current page and other information
400
  pdf_state = gr.State()