Spaces:
Running
Running
Commit
·
0039573
1
Parent(s):
c914404
💡 Fix Upscaler Class Being Created At Module Level
Browse files
App.py
CHANGED
|
@@ -252,8 +252,10 @@ with App.Blocks(
|
|
| 252 |
InputVideo = App.Video(
|
| 253 |
label='Input Video', sources=['upload'], height=300
|
| 254 |
)
|
| 255 |
-
|
| 256 |
-
|
|
|
|
|
|
|
| 257 |
InputModel = App.Dropdown(
|
| 258 |
choices=ModelNames,
|
| 259 |
label='Select Model',
|
|
@@ -328,8 +330,20 @@ with App.Blocks(
|
|
| 328 |
outputs=[InputThreshold, InputMinPercentage, InputMaxRectangles, InputPadding],
|
| 329 |
)
|
| 330 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 331 |
SubmitButton.click(
|
| 332 |
-
fn=
|
| 333 |
inputs=[
|
| 334 |
InputVideo,
|
| 335 |
InputModel,
|
|
|
|
| 252 |
InputVideo = App.Video(
|
| 253 |
label='Input Video', sources=['upload'], height=300
|
| 254 |
)
|
| 255 |
+
def GetModelNames():
|
| 256 |
+
return [Path(model).stem for model in Upscaler().ListModels()]
|
| 257 |
+
|
| 258 |
+
ModelNames = GetModelNames()
|
| 259 |
InputModel = App.Dropdown(
|
| 260 |
choices=ModelNames,
|
| 261 |
label='Select Model',
|
|
|
|
| 330 |
outputs=[InputThreshold, InputMinPercentage, InputMaxRectangles, InputPadding],
|
| 331 |
)
|
| 332 |
|
| 333 |
+
def ProcessWrapper(InputVideo, InputModel, InputUseRegions, InputThreshold, InputMinPercentage, InputMaxRectangles, InputPadding, Progress=App.Progress()):
|
| 334 |
+
return Upscaler().Process(
|
| 335 |
+
InputVideo,
|
| 336 |
+
InputModel,
|
| 337 |
+
InputUseRegions,
|
| 338 |
+
InputThreshold,
|
| 339 |
+
InputMinPercentage,
|
| 340 |
+
InputMaxRectangles,
|
| 341 |
+
InputPadding,
|
| 342 |
+
Progress
|
| 343 |
+
)
|
| 344 |
+
|
| 345 |
SubmitButton.click(
|
| 346 |
+
fn=ProcessWrapper,
|
| 347 |
inputs=[
|
| 348 |
InputVideo,
|
| 349 |
InputModel,
|