Spaces:
Sleeping
Sleeping
Commit
·
12c23e9
1
Parent(s):
950001d
File management + gitignore
Browse files- .gitignore +1 -0
- .idea/CaptionProject.iml +0 -7
- Pages/main_page.py +0 -58
- Pages/registration_page.py +0 -12
.gitignore
CHANGED
|
@@ -89,5 +89,6 @@ Resources/upload.py
|
|
| 89 |
Resources/users.json
|
| 90 |
Resources/videos.json
|
| 91 |
Resources/captions_backup.jsonl
|
|
|
|
| 92 |
venv
|
| 93 |
**/__pycache__
|
|
|
|
| 89 |
Resources/users.json
|
| 90 |
Resources/videos.json
|
| 91 |
Resources/captions_backup.jsonl
|
| 92 |
+
Resources/writetoken1.txt
|
| 93 |
venv
|
| 94 |
**/__pycache__
|
.idea/CaptionProject.iml
CHANGED
|
@@ -7,11 +7,4 @@
|
|
| 7 |
<orderEntry type="inheritedJdk" />
|
| 8 |
<orderEntry type="sourceFolder" forTests="false" />
|
| 9 |
</component>
|
| 10 |
-
<component name="PyNamespacePackagesService">
|
| 11 |
-
<option name="namespacePackageFolders">
|
| 12 |
-
<list>
|
| 13 |
-
<option value="$MODULE_DIR$/Pages" />
|
| 14 |
-
</list>
|
| 15 |
-
</option>
|
| 16 |
-
</component>
|
| 17 |
</module>
|
|
|
|
| 7 |
<orderEntry type="inheritedJdk" />
|
| 8 |
<orderEntry type="sourceFolder" forTests="false" />
|
| 9 |
</component>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
</module>
|
Pages/main_page.py
DELETED
|
@@ -1,58 +0,0 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
-
from .Functions.video_player_functions import youtube_link_to_id, get_video_embed_by_id, get_video_link_by_pointer
|
| 3 |
-
from .Functions.caption_editor_functions import get_captions_by_video_id, save_dataframe
|
| 4 |
-
from .Resources.css import css
|
| 5 |
-
|
| 6 |
-
next_video_pointer = 0
|
| 7 |
-
user = ""
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
def get_username(request: gr.Request):
|
| 11 |
-
global user
|
| 12 |
-
user = request.username
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
def save(df, video_id):
|
| 16 |
-
return save_dataframe(df, video_id, user)
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
def get_next_components():
|
| 20 |
-
global next_video_pointer
|
| 21 |
-
next_video_link = get_video_link_by_pointer(next_video_pointer)
|
| 22 |
-
next_video_pointer += 1
|
| 23 |
-
if next_video_link is None:
|
| 24 |
-
next_video_link = get_video_link_by_pointer(0)
|
| 25 |
-
next_video_pointer = 1
|
| 26 |
-
|
| 27 |
-
next_video_id = youtube_link_to_id(next_video_link)
|
| 28 |
-
|
| 29 |
-
next_video = get_video_embed_by_id(next_video_id)
|
| 30 |
-
next_captions = get_captions_by_video_id(next_video_id)
|
| 31 |
-
|
| 32 |
-
return next_video, next_captions, next_video_id
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
(start_video, start_captions, start_video_id) = get_next_components()
|
| 36 |
-
|
| 37 |
-
with gr.Blocks(css=css) as main_page:
|
| 38 |
-
gr.Markdown("## Caption Editor")
|
| 39 |
-
current_video_id = gr.Textbox(value=start_video_id, visible=False, interactive=False)
|
| 40 |
-
with gr.Row():
|
| 41 |
-
with gr.Column():
|
| 42 |
-
caption_editor = gr.DataFrame(interactive=True,
|
| 43 |
-
value=start_captions,
|
| 44 |
-
datatype=["number", "str", "number"],
|
| 45 |
-
row_count=(start_captions.shape[0], "fixed"),
|
| 46 |
-
col_count=(3, "fixed"), column_widths=["20%", "60%", "20%"])
|
| 47 |
-
save_button = gr.Button(value="Save")
|
| 48 |
-
save_result = gr.Markdown()
|
| 49 |
-
with gr.Column():
|
| 50 |
-
video_embed = gr.HTML(value=start_video)
|
| 51 |
-
next_video_button = gr.Button("Next")
|
| 52 |
-
|
| 53 |
-
next_video_button.click(fn=get_next_components,
|
| 54 |
-
outputs=[video_embed, caption_editor, current_video_id])
|
| 55 |
-
save_button.click(fn=save,
|
| 56 |
-
inputs=[caption_editor, current_video_id],
|
| 57 |
-
outputs=save_result)
|
| 58 |
-
main_page.load(get_username)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Pages/registration_page.py
DELETED
|
@@ -1,12 +0,0 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
-
from .Functions.auth_functions import register
|
| 3 |
-
|
| 4 |
-
with gr.Blocks() as registration:
|
| 5 |
-
with gr.Column(variant="panel"):
|
| 6 |
-
gr.Markdown(value="# Create Account")
|
| 7 |
-
username = gr.Textbox(label="Username", show_label=True, lines=1)
|
| 8 |
-
password = gr.Textbox(label="Password", show_label=True, lines=1, type="password")
|
| 9 |
-
registration_button = gr.Button(value="Register")
|
| 10 |
-
registration_result = gr.Markdown()
|
| 11 |
-
|
| 12 |
-
registration_button.click(fn=register, inputs=[username, password], outputs=registration_result)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|