TIMBOVILL commited on
Commit
04f0cbd
1 Parent(s): 70e2653

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -20
app.py CHANGED
@@ -73,25 +73,39 @@ additional_inputs = [
73
  gr.Number(precision=0, value=42, label="Seed", info="A starting point to initiate generation, use 0 for random")
74
  ]
75
 
76
- with gr.Blocks(theme=gr.themes.Soft(primary_hue="red", secondary_hue="pink")) as demo:
77
- with gr.Tabs():
78
- with gr.TabItem("Chat"):
79
- chat_interface = gr.ChatInterface(
80
- fn=generate_response,
81
- chatbot=gr.Chatbot(show_label=False, show_share_button=False, show_copy_button=True, likeable=True, layout="panel"),
82
- additional_inputs=additional_inputs,
83
- title="YTSHorts Maker",
84
- description="Powered by GROQ, MoviePy, and other tools.",
85
- )
86
- with gr.TabItem("Video Processing"):
87
- text_input = gr.Textbox(lines=5, label="Text (8 words max per line)")
88
- process_button = gr.Button("Process Video")
89
- video_output = gr.Video(label="Processed Video")
90
-
91
- process_button.click(
92
- fn=process_video,
93
- inputs=[text_input],
94
- outputs=video_output,
95
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
 
97
  demo.launch()
 
73
  gr.Number(precision=0, value=42, label="Seed", info="A starting point to initiate generation, use 0 for random")
74
  ]
75
 
76
+ chat_interface = gr.ChatInterface(
77
+ fn=generate_response,
78
+ chatbot=gr.Chatbot(show_label=False, show_share_button=False, show_copy_button=True, likeable=True, layout="panel"),
79
+ additional_inputs=additional_inputs,
80
+ title="YTSHorts Maker",
81
+ description="Powered by GROQ, MoviePy, and other tools.",
82
+ )
83
+
84
+ def process_video_interface():
85
+ text_input = gr.Textbox(lines=5, label="Text (8 words max per line)")
86
+ process_button = gr.Button("Process Video")
87
+ video_output = gr.Video(label="Processed Video")
88
+
89
+ def process_video_callback():
90
+ text = text_input.value
91
+ output_path = process_video(text)
92
+ video_output.value = output_path
93
+
94
+ process_button.click(process_video_callback)
95
+
96
+ return gr.Interface(
97
+ fn=process_video_callback,
98
+ inputs=[text_input],
99
+ outputs=video_output,
100
+ title="Video Processing",
101
+ description="Select a video file from 'videos' folder, add text, and process.",
102
+ )
103
+
104
+ demo = gr.Interface(
105
+ [chat_interface, process_video_interface()],
106
+ title="YTSHorts Maker",
107
+ description="Powered by GROQ, MoviePy, and other tools.",
108
+ theme="soft",
109
+ )
110
 
111
  demo.launch()