LittleLirow commited on
Commit
d510b6e
1 Parent(s): 0d80a43

Add interface prototype

Browse files
Files changed (2) hide show
  1. .gitignore +2 -0
  2. app.py +42 -4
.gitignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ *.mp4
2
+ __pycache__/
app.py CHANGED
@@ -1,7 +1,45 @@
 
1
  import gradio as gr
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
 
 
 
 
 
 
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
  import gradio as gr
3
+ import os
4
 
5
+ def show_textbox(radio_state):
6
+ if(radio_state == "User Input"):
7
+ return [gr.Textbox.update(visible=False), gr.Textbox.update(visible=False), gr.Textbox.update(visible=True)]
8
+ elif(radio_state == "ChatGPT"):
9
+ return [gr.Textbox.update(visible=True), gr.Textbox.update(visible=True), gr.Textbox.update(visible=False)]
10
+ elif(radio_state == "PlaceholderModel"):
11
+ return [gr.Textbox.update(visible=True), gr.Textbox.update(visible=True), gr.Textbox.update(visible=False)]
12
+ else:
13
+ return [gr.Textbox.update(visible=False) for _ in range(3)]
14
 
15
+ def generate_video(x):
16
+ return x
17
+
18
+ def download_video(v):
19
+ pass
20
+
21
+ with gr.Blocks() as demo:
22
+ gr.Markdown("Generate a narrated horror story video from a text prompt or your own story.")
23
+
24
+ with gr.Row():
25
+ with gr.Column():
26
+ radio_input = gr.Radio(["ChatGPT", "PlaceholderModel", "User Input"], type="value", label="Input method")
27
+ auth_input = gr.Textbox(label="Auth Key", max_lines=1, visible=False, interactive=True)
28
+ prompt_input = gr.Textbox(label="Prompt", lines=5, visible=False, interactive=True)
29
+ text_input = gr.Textbox(label="Your Story", lines=5, visible=False, interactive=True)
30
+
31
+ text_lst = [auth_input, prompt_input, text_input]
32
+ radio_input.change(show_textbox, radio_input, text_lst)
33
+
34
+ generate_button = gr.Button("Generate Video")
35
+
36
+ with gr.Column():
37
+ out_path = os.path.join(os.path.dirname(os.getcwd()), "fearflixai/src","example.mp4")
38
+ print(out_path)
39
+ video_out = gr.PlayableVideo(out_path)
40
+ download_button = gr.Button("Download")
41
+
42
+ generate_button.click(generate_video, inputs=video_out, outputs=video_out)
43
+ download_button.click(download_video, inputs=video_out)
44
+
45
+ demo.launch()