Spaces:
Sleeping
Sleeping
Anne Marthe Sophie Ngo Bibinbe
commited on
Commit
·
22cc388
1
Parent(s):
1b669fd
Update space
Browse files
app.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
import numpy as np
|
| 3 |
import random
|
| 4 |
|
|
@@ -151,4 +151,36 @@ with gr.Blocks(css=css) as demo:
|
|
| 151 |
)
|
| 152 |
|
| 153 |
if __name__ == "__main__":
|
| 154 |
-
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'''import gradio as gr
|
| 2 |
import numpy as np
|
| 3 |
import random
|
| 4 |
|
|
|
|
| 151 |
)
|
| 152 |
|
| 153 |
if __name__ == "__main__":
|
| 154 |
+
demo.launch(share=True)
|
| 155 |
+
'''
|
| 156 |
+
|
| 157 |
+
|
| 158 |
+
import gradio as gr
|
| 159 |
+
import shutil
|
| 160 |
+
import os
|
| 161 |
+
|
| 162 |
+
def process_video(video_path, prompt):
|
| 163 |
+
output_video = "output.mp4" # Placeholder for processed video
|
| 164 |
+
output_file = "output.txt" # Placeholder for generated file
|
| 165 |
+
|
| 166 |
+
# Copy the input video to simulate processing
|
| 167 |
+
shutil.copy(video_path, output_video)
|
| 168 |
+
|
| 169 |
+
# Create an output text file with the prompt content
|
| 170 |
+
with open(output_file, "w") as f:
|
| 171 |
+
f.write(f"User Prompt: {prompt}\n")
|
| 172 |
+
|
| 173 |
+
return output_video, output_file
|
| 174 |
+
|
| 175 |
+
# Define Gradio interface
|
| 176 |
+
iface = gr.Interface(
|
| 177 |
+
fn=process_video,
|
| 178 |
+
inputs=[gr.Video(type="filepath"), gr.Textbox(placeholder="Enter your prompt")],
|
| 179 |
+
outputs=[gr.Video(), gr.File(label="Generated File")],
|
| 180 |
+
title="Video Processing App",
|
| 181 |
+
description="Upload a video and enter a prompt. The app will return the processed video and a generated file."
|
| 182 |
+
)
|
| 183 |
+
|
| 184 |
+
# Launch the app
|
| 185 |
+
if __name__ == "__main__":
|
| 186 |
+
iface.launch()
|