Shuja007 commited on
Commit
5870b52
1 Parent(s): a9a23f0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -5,7 +5,9 @@ import base64
5
  # Function to call the NVIDIA API and generate a video
6
  def generate_video(image):
7
  # Convert the uploaded image to a base64 string
8
- image_base64 = base64.b64encode(image.read()).decode('utf-8')
 
 
9
  invoke_url = "https://ai.api.nvidia.com/v1/genai/stabilityai/stable-video-diffusion"
10
 
11
  headers = {
@@ -34,7 +36,7 @@ def create_interface():
34
  # Gradio Interface
35
  iface = gr.Interface(
36
  fn=generate_video,
37
- inputs=gr.Image(type="file", label="Upload Your Product Image"),
38
  outputs=gr.Video(label="Generated Product Video"), # Use gr.Video to display the video output
39
  title=title,
40
  description="Upload a product shot to generate a moving video version of it."
 
5
  # Function to call the NVIDIA API and generate a video
6
  def generate_video(image):
7
  # Convert the uploaded image to a base64 string
8
+ with open(image, "rb") as img_file:
9
+ image_base64 = base64.b64encode(img_file.read()).decode('utf-8')
10
+
11
  invoke_url = "https://ai.api.nvidia.com/v1/genai/stabilityai/stable-video-diffusion"
12
 
13
  headers = {
 
36
  # Gradio Interface
37
  iface = gr.Interface(
38
  fn=generate_video,
39
+ inputs=gr.Image(type="filepath", label="Upload Your Product Image"),
40
  outputs=gr.Video(label="Generated Product Video"), # Use gr.Video to display the video output
41
  title=title,
42
  description="Upload a product shot to generate a moving video version of it."