Hu Xu
commited on
Commit
·
84affb9
1
Parent(s):
e4a2361
refactor
Browse files
app.py
CHANGED
@@ -1,13 +1,15 @@
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
|
|
|
|
|
|
3 |
|
4 |
entry_count = None
|
5 |
metadata = None
|
6 |
|
7 |
def init_demo():
|
8 |
-
import json
|
9 |
-
import numpy as np
|
10 |
-
|
11 |
global metadata
|
12 |
with open("metadata.json") as f:
|
13 |
metadata = json.load(f)
|
@@ -20,11 +22,6 @@ def init_demo():
|
|
20 |
|
21 |
|
22 |
def curation(text):
|
23 |
-
import sys
|
24 |
-
sys.path.append("./")
|
25 |
-
from metaclip.substr_matching import substr_matching
|
26 |
-
from metaclip.balancing import balance_sampling
|
27 |
-
|
28 |
t = 20000 # TODO: make this part of the UI
|
29 |
entry_count[entry_count < t] = t
|
30 |
entry_prob = t / entry_count
|
|
|
1 |
+
import json
|
2 |
+
import numpy as np
|
3 |
import gradio as gr
|
4 |
|
5 |
+
from metaclip.substr_matching import substr_matching
|
6 |
+
from metaclip.balancing import balance_sampling
|
7 |
+
|
8 |
|
9 |
entry_count = None
|
10 |
metadata = None
|
11 |
|
12 |
def init_demo():
|
|
|
|
|
|
|
13 |
global metadata
|
14 |
with open("metadata.json") as f:
|
15 |
metadata = json.load(f)
|
|
|
22 |
|
23 |
|
24 |
def curation(text):
|
|
|
|
|
|
|
|
|
|
|
25 |
t = 20000 # TODO: make this part of the UI
|
26 |
entry_count[entry_count < t] = t
|
27 |
entry_prob = t / entry_count
|