Spaces:
Runtime error
Runtime error
from os import pipe | |
import gradio as gr | |
from functions.punctuation import punctuate | |
from functions.model_infer import predict_from_document | |
title = "sponsoredBye - never listen to sponsors again" | |
description = "Sponsored sections in videos are annoying and take up a lot of time. Improve your YouTube watching experience, by filling in the youtube url and figure out what segments to skip." | |
article = "Check out [the original Rick and Morty Bot](https://huggingface.co/spaces/kingabzpro/Rick_and_Morty_Bot) that this demo is based off of." | |
def pipeline(video_url): | |
video_id = video_url.split("?v=")[-1] | |
punctuated_text = punctuate(video_id) | |
sentences = re.split(r"[\.\!\?]\s", punctuated_text) | |
classification = predict_from_document(sentences) | |
# return punctuated_text | |
return [{"start": "12:05", "end": "12:52", "classification": str(classification)}] | |
# print(pipeline("VL5M5ZihJK4")) | |
demo = gr.Interface( | |
fn=pipeline, | |
title=title, | |
description=description, | |
inputs="text", | |
# outputs=gr.Label(num_top_classes=3), | |
outputs="json", | |
examples=[ | |
"https://www.youtube.com/watch?v=VL5M5ZihJK4", | |
"https://www.youtube.com/watch?v=VL5M5ZihJK4", | |
], | |
) | |
demo.launch(share=True) | |