Added dropdown for selecting a generator model, commented out length slider.
Browse files
app.py
CHANGED
@@ -45,7 +45,13 @@ import PIL
|
|
45 |
|
46 |
|
47 |
# ###### Generate ECGs ######################################################
|
48 |
-
def predict(numberOfECGs
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
# ====== Set ECG type ====================================================
|
51 |
ecgType = deepfakeecg.DATA_ECG12
|
@@ -189,10 +195,11 @@ with gradio.Blocks(css = css, theme = gradio.themes.Glass(secondary_hue=gradio.t
|
|
189 |
""")
|
190 |
gradio.Markdown('## Settings')
|
191 |
with gradio.Row():
|
192 |
-
sliderNumberOfECGs
|
193 |
-
sliderLengthInSeconds = gradio.Slider(5, 60, label="Length (s)", step = 5, value = 10, interactive = True)
|
194 |
-
dropdownType
|
195 |
-
|
|
|
196 |
gradio.Markdown('## Output')
|
197 |
with gradio.Row():
|
198 |
outputGallery = gradio.Gallery(label = 'output', columns = [ 1 ], height = 'auto',
|
@@ -201,13 +208,19 @@ with gradio.Blocks(css = css, theme = gradio.themes.Glass(secondary_hue=gradio.t
|
|
201 |
|
202 |
# ====== Add click event handling for "Generate" button ==================
|
203 |
buttonGenerate.click(predict,
|
204 |
-
inputs = [ sliderNumberOfECGs,
|
|
|
|
|
|
|
205 |
outputs = [ outputGallery ]
|
206 |
)
|
207 |
|
208 |
# ====== Run on startup ==================================================
|
209 |
gui.load(predict,
|
210 |
-
inputs = [ sliderNumberOfECGs,
|
|
|
|
|
|
|
211 |
outputs = [ outputGallery ]
|
212 |
)
|
213 |
|
|
|
45 |
|
46 |
|
47 |
# ###### Generate ECGs ######################################################
|
48 |
+
def predict(numberOfECGs = 1,
|
49 |
+
# ecgLengthInSeconds = 10,
|
50 |
+
ecgTypeString = 'ECG-12',
|
51 |
+
generatorModel = 'Default',
|
52 |
+
) -> list:
|
53 |
+
|
54 |
+
ecgLengthInSeconds = 10
|
55 |
|
56 |
# ====== Set ECG type ====================================================
|
57 |
ecgType = deepfakeecg.DATA_ECG12
|
|
|
195 |
""")
|
196 |
gradio.Markdown('## Settings')
|
197 |
with gradio.Row():
|
198 |
+
sliderNumberOfECGs = gradio.Slider(1, 100, label="Number of ECGs", step = 1, value = 4, interactive = True)
|
199 |
+
# sliderLengthInSeconds = gradio.Slider(5, 60, label="Length (s)", step = 5, value = 10, interactive = True)
|
200 |
+
dropdownType = gradio.Dropdown( [ 'ECG-12', 'ECG-8' ], label = 'ECG Type', interactive = True)
|
201 |
+
dropdownGeneratorModel = gradio.Dropdown( [ 'Default' ], label = 'Generator Model', interactive = True)
|
202 |
+
buttonGenerate = gradio.Button("Generate")
|
203 |
gradio.Markdown('## Output')
|
204 |
with gradio.Row():
|
205 |
outputGallery = gradio.Gallery(label = 'output', columns = [ 1 ], height = 'auto',
|
|
|
208 |
|
209 |
# ====== Add click event handling for "Generate" button ==================
|
210 |
buttonGenerate.click(predict,
|
211 |
+
inputs = [ sliderNumberOfECGs,
|
212 |
+
# sliderLengthInSeconds,
|
213 |
+
dropdownType,
|
214 |
+
dropdownGeneratorModel ],
|
215 |
outputs = [ outputGallery ]
|
216 |
)
|
217 |
|
218 |
# ====== Run on startup ==================================================
|
219 |
gui.load(predict,
|
220 |
+
inputs = [ sliderNumberOfECGs,
|
221 |
+
# sliderLengthInSeconds,
|
222 |
+
dropdownType,
|
223 |
+
dropdownGeneratorModel ],
|
224 |
outputs = [ outputGallery ]
|
225 |
)
|
226 |
|