Spaces:
Running
Running
Joshua Lochner commited on
Commit ·
9ce97dc
1
Parent(s): 00f77c2
Update app.py
Browse files
app.py
CHANGED
|
@@ -35,6 +35,7 @@ MODEL_PATH = 'Xenova/sponsorblock-small_v2022.01.19'
|
|
| 35 |
|
| 36 |
CLASSIFIER_PATH = 'Xenova/sponsorblock-classifier'
|
| 37 |
|
|
|
|
| 38 |
@st.cache(allow_output_mutation=True)
|
| 39 |
def persistdata():
|
| 40 |
return {}
|
|
@@ -57,8 +58,16 @@ def load_predict():
|
|
| 57 |
tokenizer = AutoTokenizer.from_pretrained(evaluation_args.model_path)
|
| 58 |
|
| 59 |
# Save classifier and vectorizer
|
| 60 |
-
hf_hub_download(repo_id=CLASSIFIER_PATH,
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
|
| 63 |
def predict_function(video_id):
|
| 64 |
if video_id not in predictions_cache:
|
|
@@ -90,7 +99,7 @@ def main():
|
|
| 90 |
st.write('##### Automatically detect in-video YouTube sponsorships, self/unpaid promotions, and interaction reminders.')
|
| 91 |
|
| 92 |
# Load widgets
|
| 93 |
-
video_id = st.text_input('Video ID:')
|
| 94 |
|
| 95 |
categories = st.multiselect('Categories:',
|
| 96 |
CATGEGORY_OPTIONS.keys(),
|
|
|
|
| 35 |
|
| 36 |
CLASSIFIER_PATH = 'Xenova/sponsorblock-classifier'
|
| 37 |
|
| 38 |
+
|
| 39 |
@st.cache(allow_output_mutation=True)
|
| 40 |
def persistdata():
|
| 41 |
return {}
|
|
|
|
| 58 |
tokenizer = AutoTokenizer.from_pretrained(evaluation_args.model_path)
|
| 59 |
|
| 60 |
# Save classifier and vectorizer
|
| 61 |
+
hf_hub_download(repo_id=CLASSIFIER_PATH,
|
| 62 |
+
filename=classifier_args.classifier_file,
|
| 63 |
+
cache_dir=classifier_args.classifier_dir,
|
| 64 |
+
force_filename=classifier_args.classifier_file,
|
| 65 |
+
)
|
| 66 |
+
hf_hub_download(repo_id=CLASSIFIER_PATH,
|
| 67 |
+
filename=classifier_args.vectorizer_file,
|
| 68 |
+
cache_dir=classifier_args.classifier_dir,
|
| 69 |
+
force_filename=classifier_args.vectorizer_file,
|
| 70 |
+
)
|
| 71 |
|
| 72 |
def predict_function(video_id):
|
| 73 |
if video_id not in predictions_cache:
|
|
|
|
| 99 |
st.write('##### Automatically detect in-video YouTube sponsorships, self/unpaid promotions, and interaction reminders.')
|
| 100 |
|
| 101 |
# Load widgets
|
| 102 |
+
video_id = st.text_input('Video ID:') # , placeholder='e.g., axtQvkSpoto'
|
| 103 |
|
| 104 |
categories = st.multiselect('Categories:',
|
| 105 |
CATGEGORY_OPTIONS.keys(),
|