Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -102,34 +102,6 @@ def create_mask_zip(mask, output_name='masks.zip'):
|
|
| 102 |
buffer.seek(0)
|
| 103 |
return buffer, output_name
|
| 104 |
|
| 105 |
-
class MaskZipOutput(gr.outputs.OutputComponent):
|
| 106 |
-
def __init__(self):
|
| 107 |
-
self.label = "Download Masks"
|
| 108 |
-
self.filename = "masks.zip"
|
| 109 |
-
self.mime_type = "application/zip"
|
| 110 |
-
|
| 111 |
-
def get_template_context(self):
|
| 112 |
-
return {
|
| 113 |
-
"label": self.label,
|
| 114 |
-
"filename": self.filename,
|
| 115 |
-
"mime_type": self.mime_type
|
| 116 |
-
}
|
| 117 |
-
|
| 118 |
-
def component_type(self):
|
| 119 |
-
return "output.file"
|
| 120 |
-
|
| 121 |
-
def to_response(self, value):
|
| 122 |
-
if value is None:
|
| 123 |
-
return {}
|
| 124 |
-
return {
|
| 125 |
-
"file": {
|
| 126 |
-
"name": self.filename,
|
| 127 |
-
"content": value.read(),
|
| 128 |
-
"mime_type": self.mime_type
|
| 129 |
-
}
|
| 130 |
-
}
|
| 131 |
-
|
| 132 |
-
|
| 133 |
# Define the custom legend HTML
|
| 134 |
legend_html = '''
|
| 135 |
<div style="font-size: 14px; font-weight: bold; display: flex; flex-wrap: wrap; margin-top: 10px;">
|
|
|
|
| 102 |
buffer.seek(0)
|
| 103 |
return buffer, output_name
|
| 104 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
# Define the custom legend HTML
|
| 106 |
legend_html = '''
|
| 107 |
<div style="font-size: 14px; font-weight: bold; display: flex; flex-wrap: wrap; margin-top: 10px;">
|