Spaces:
Running
Running
DebasishDhal99
commited on
Commit
•
b276a18
1
Parent(s):
a485b16
Update app.py
Browse files
app.py
CHANGED
@@ -14,49 +14,50 @@ def playlist_duration_calculator(playlist_link, calculation_type):
|
|
14 |
result = playlist_average_duration_func(playlist_link)
|
15 |
return f"Average Duration: {result}"
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
|
21 |
-
|
22 |
-
|
23 |
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
|
38 |
-
second_heading = "YouTube Playlist Mismatch Calculator"
|
39 |
-
second_description = "Enter two YouTube playlist links (without quotation marks) to compare their contents and find the mismatch."
|
40 |
-
mismatch_outputs = gr.outputs.Textbox(label="Mismatch between two playlists")
|
41 |
|
42 |
def playlist_mismatch_calculator(playlist_link_1, playlist_link_2):
|
43 |
result = playlists_mismatch_func(playlist_link_1, playlist_link_2, output='name')
|
44 |
return f"Mismatch Result: {result}"
|
45 |
|
46 |
-
playlist_link_1_input = gr.inputs.Textbox(label="Playlist Link 1")
|
47 |
-
playlist_link_2_input = gr.inputs.Textbox(label="Playlist Link 2")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
-
interface2 = gr.Interface(
|
50 |
-
fn=playlist_mismatch_calculator,
|
51 |
-
inputs=[playlist_link_1_input, playlist_link_2_input],
|
52 |
-
outputs=mismatch_outputs,
|
53 |
-
title=second_heading,
|
54 |
-
description=second_description,
|
55 |
-
examples=[
|
56 |
-
["https://www.youtube.com/playlist?list=PL-osiE80TeTsWmV9i9c58mdDCSskIFdDS", "https://www.youtube.com/playlist?list=PL-osiE80TeTtoQCKZ03TU5fNfx2UY6U4p"],
|
57 |
-
],
|
58 |
-
theme="compact",
|
59 |
-
)
|
60 |
|
61 |
-
|
62 |
-
interface2.launch()
|
|
|
14 |
result = playlist_average_duration_func(playlist_link)
|
15 |
return f"Average Duration: {result}"
|
16 |
|
17 |
+
playlist_link_input = gr.inputs.Textbox(label="Playlist Link")
|
18 |
+
calculation_type_input = gr.inputs.Radio(["Total Duration", "Average Duration"], label="What to calculate?")
|
19 |
+
outputs = gr.outputs.Textbox(label="Result")
|
20 |
|
21 |
+
heading = "YouTube Playlist Duration Calculator"
|
22 |
+
description = "Enter a YouTube playlist link and choose the calculation type to calculate its total duration or average duration."
|
23 |
|
24 |
|
25 |
+
interface1 = gr.Interface(
|
26 |
+
fn=playlist_duration_calculator,
|
27 |
+
inputs=[playlist_link_input, calculation_type_input],
|
28 |
+
outputs=outputs,
|
29 |
+
title=heading,
|
30 |
+
description=description,
|
31 |
+
examples=[
|
32 |
+
["https://www.youtube.com/playlist?list=PL-osiE80TeTsWmV9i9c58mdDCSskIFdDS", "Total Duration"],
|
33 |
+
["https://www.youtube.com/playlist?list=PL-osiE80TeTtoQCKZ03TU5fNfx2UY6U4p", "Average Duration"],
|
34 |
+
],
|
35 |
+
theme="compact",
|
36 |
+
)
|
37 |
|
38 |
+
# second_heading = "YouTube Playlist Mismatch Calculator"
|
39 |
+
# second_description = "Enter two YouTube playlist links (without quotation marks) to compare their contents and find the mismatch."
|
40 |
+
# mismatch_outputs = gr.outputs.Textbox(label="Mismatch between two playlists")
|
41 |
|
42 |
def playlist_mismatch_calculator(playlist_link_1, playlist_link_2):
|
43 |
result = playlists_mismatch_func(playlist_link_1, playlist_link_2, output='name')
|
44 |
return f"Mismatch Result: {result}"
|
45 |
|
46 |
+
# playlist_link_1_input = gr.inputs.Textbox(label="Playlist Link 1")
|
47 |
+
# playlist_link_2_input = gr.inputs.Textbox(label="Playlist Link 2")
|
48 |
+
|
49 |
+
# interface2 = gr.Interface(
|
50 |
+
# fn=playlist_mismatch_calculator,
|
51 |
+
# inputs=[playlist_link_1_input, playlist_link_2_input],
|
52 |
+
# outputs=mismatch_outputs,
|
53 |
+
# title=second_heading,
|
54 |
+
# description=second_description,
|
55 |
+
# examples=[
|
56 |
+
# ["https://www.youtube.com/playlist?list=PL-osiE80TeTsWmV9i9c58mdDCSskIFdDS", "https://www.youtube.com/playlist?list=PL-osiE80TeTtoQCKZ03TU5fNfx2UY6U4p"],
|
57 |
+
# ],
|
58 |
+
# theme="compact",
|
59 |
+
# )
|
60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
|
62 |
+
interface1.launch()
|
63 |
+
# interface2.launch()
|