cadige commited on
Commit
29aad08
1 Parent(s): cc7d190

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +32 -0
  2. requirements.txt +6 -0
app.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import importlib
2
+ import gradio as gr
3
+ import os
4
+ import sys
5
+ import copy
6
+ import pathlib
7
+
8
+ # At least one demo fails when caching examples
9
+ # Temporary fix just to get the build to pass
10
+ os.environ["SYSTEM"] = "SPACES"
11
+
12
+ demo_dir = pathlib.Path(__file__).parent / "demos"
13
+
14
+
15
+ all_demos = []
16
+ demo_module = None
17
+ for p in os.listdir("./demos"):
18
+ old_path = copy.deepcopy(sys.path)
19
+ sys.path = [os.path.join(demo_dir, p)] + sys.path
20
+ if demo_module is None:
21
+ demo_module = importlib.import_module(f"run")
22
+ else:
23
+ demo_module = importlib.reload(demo_module)
24
+ all_demos.append((p, demo_module.demo))
25
+
26
+ with gr.Blocks() as mega_demo:
27
+ with gr.Tabs():
28
+ for demo_name, demo in all_demos:
29
+ with gr.TabItem(demo_name):
30
+ demo.render()
31
+
32
+ mega_demo.launch()
requirements.txt ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ pypistats
2
+ plotly
3
+ opencv-python
4
+ transformers
5
+ torch
6
+ https://gradio-builds.s3.amazonaws.com/2012/gradio-3.1.4-py3-none-any.whl