Spaces:
Runtime error
Runtime error
Commit
Β·
ca1703a
1
Parent(s):
54939b3
app.py
CHANGED
|
@@ -2,12 +2,8 @@ import gradio as gr
|
|
| 2 |
import torch
|
| 3 |
from tabs.FACS_analysis import create_facs_analysis_tab
|
| 4 |
from ui_components import CUSTOM_CSS, HEADER_HTML, DISCLAIMER_HTML
|
| 5 |
-
import spaces # Importing spaces to utilize GPU
|
| 6 |
|
| 7 |
-
import logging
|
| 8 |
-
|
| 9 |
-
logging.basicConfig(level=logging.INFO)
|
| 10 |
-
logger = logging.getLogger(__name__)
|
| 11 |
|
| 12 |
# Define the tab structure
|
| 13 |
TAB_STRUCTURE = [
|
|
@@ -16,11 +12,11 @@ TAB_STRUCTURE = [
|
|
| 16 |
])
|
| 17 |
]
|
| 18 |
|
|
|
|
|
|
|
| 19 |
def create_demo():
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
# Ensure that any models loaded within create_facs_analysis_tab use the correct device
|
| 24 |
with gr.Blocks(css=CUSTOM_CSS) as demo:
|
| 25 |
gr.Markdown(HEADER_HTML)
|
| 26 |
with gr.Tabs(elem_classes=["main-tab"]):
|
|
@@ -29,12 +25,12 @@ def create_demo():
|
|
| 29 |
with gr.Tabs():
|
| 30 |
for sub_tab, create_fn in sub_tabs:
|
| 31 |
with gr.Tab(sub_tab):
|
| 32 |
-
create_fn(
|
| 33 |
gr.HTML(DISCLAIMER_HTML)
|
| 34 |
-
|
| 35 |
return demo
|
| 36 |
|
| 37 |
-
# Create the demo instance
|
| 38 |
demo = create_demo()
|
| 39 |
|
| 40 |
if __name__ == "__main__":
|
|
|
|
| 2 |
import torch
|
| 3 |
from tabs.FACS_analysis import create_facs_analysis_tab
|
| 4 |
from ui_components import CUSTOM_CSS, HEADER_HTML, DISCLAIMER_HTML
|
| 5 |
+
import spaces # Importing spaces to utilize Zero GPU
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
# Define the tab structure
|
| 9 |
TAB_STRUCTURE = [
|
|
|
|
| 12 |
])
|
| 13 |
]
|
| 14 |
|
| 15 |
+
# Decorate GPU-dependent function with Zero GPU
|
| 16 |
+
@spaces.GPU(duration=120) # Allocates GPU for 120 seconds when needed
|
| 17 |
def create_demo():
|
| 18 |
+
|
| 19 |
+
# Gradio blocks to create the interface
|
|
|
|
|
|
|
| 20 |
with gr.Blocks(css=CUSTOM_CSS) as demo:
|
| 21 |
gr.Markdown(HEADER_HTML)
|
| 22 |
with gr.Tabs(elem_classes=["main-tab"]):
|
|
|
|
| 25 |
with gr.Tabs():
|
| 26 |
for sub_tab, create_fn in sub_tabs:
|
| 27 |
with gr.Tab(sub_tab):
|
| 28 |
+
create_fn()
|
| 29 |
gr.HTML(DISCLAIMER_HTML)
|
| 30 |
+
|
| 31 |
return demo
|
| 32 |
|
| 33 |
+
# Create the demo instance
|
| 34 |
demo = create_demo()
|
| 35 |
|
| 36 |
if __name__ == "__main__":
|