Spaces:
Build error
Build error
Update main.py
Browse files
main.py
CHANGED
@@ -6,6 +6,7 @@ import subprocess
|
|
6 |
from torchvision import transforms
|
7 |
from PIL import Image
|
8 |
|
|
|
9 |
DEFAULT_FILE_NAME = 'sheet_music'
|
10 |
|
11 |
|
@@ -38,6 +39,8 @@ def convert_to_key():
|
|
38 |
return f'{file_name}.musicxml', f'{file_name}_teaser.png'
|
39 |
|
40 |
def predict(inp):
|
|
|
|
|
41 |
return convert_to_key()
|
42 |
|
43 |
|
@@ -46,7 +49,7 @@ def run():
|
|
46 |
gr.File(label='Download detection image', type='file')]
|
47 |
demo = gr.Interface(
|
48 |
fn=predict,
|
49 |
-
inputs='
|
50 |
outputs=outputs,
|
51 |
allow_flagging='never',
|
52 |
)
|
|
|
6 |
from torchvision import transforms
|
7 |
from PIL import Image
|
8 |
|
9 |
+
|
10 |
DEFAULT_FILE_NAME = 'sheet_music'
|
11 |
|
12 |
|
|
|
39 |
return f'{file_name}.musicxml', f'{file_name}_teaser.png'
|
40 |
|
41 |
def predict(inp):
|
42 |
+
img = Image.fromarray(inp)
|
43 |
+
img.save(f'{DEFAULT_FILE_NAME}.png')
|
44 |
return convert_to_key()
|
45 |
|
46 |
|
|
|
49 |
gr.File(label='Download detection image', type='file')]
|
50 |
demo = gr.Interface(
|
51 |
fn=predict,
|
52 |
+
inputs='image',
|
53 |
outputs=outputs,
|
54 |
allow_flagging='never',
|
55 |
)
|