huu-ontocord commited on
Commit
9f2ebbe
·
verified ·
1 Parent(s): 6b40782

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -4,10 +4,9 @@ import json
4
  def save_to_json(text1, text2, text3, video, agree):
5
  """Saves the input text and video to a JSON file if the checkbox is checked."""
6
  if agree:
7
- # Save the video to a file (you'll need to decide on a naming scheme)
8
- video_filename = "uploaded_video.mp4" # Example filename
9
- with open(video_filename, "wb") as f:
10
- f.write(video.read())
11
 
12
  data = {
13
  "text1": text1,
@@ -27,8 +26,8 @@ iface = gr.Interface(
27
  gr.TextArea(lines=5, placeholder="Enter text 1 here..."),
28
  gr.TextArea(lines=5, placeholder="Enter text 2 here..."),
29
  gr.TextArea(lines=5, placeholder="Enter text 3 here..."),
30
- gr.Video(format="mp4"), # Add the video input
31
- gr.Checkbox(label="I agree and have the rights to share the content I entered here under the CC-BY license.")
32
  ],
33
  outputs="text",
34
  title="Save Text and Video to JSON",
 
4
  def save_to_json(text1, text2, text3, video, agree):
5
  """Saves the input text and video to a JSON file if the checkbox is checked."""
6
  if agree:
7
+ # Save the video to an mp4 file
8
+ video_filename = "uploaded_video.mp4"
9
+ video.save(video_filename)
 
10
 
11
  data = {
12
  "text1": text1,
 
26
  gr.TextArea(lines=5, placeholder="Enter text 1 here..."),
27
  gr.TextArea(lines=5, placeholder="Enter text 2 here..."),
28
  gr.TextArea(lines=5, placeholder="Enter text 3 here..."),
29
+ gr.Video(format="mp4"),
30
+ gr.Checkbox(label="I agree and have the rights to share these prompts under the CC-BY license.")
31
  ],
32
  outputs="text",
33
  title="Save Text and Video to JSON",