Rooni commited on
Commit
db0e646
·
verified ·
1 Parent(s): 2cb0536

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -9
app.py CHANGED
@@ -12,15 +12,22 @@ client = Client("KingNish/Instant-Video")
12
 
13
  # Function
14
  def generate_image(prompt, base="Realistic", motion="", step=8, progress=gr.Progress()):
15
- result = client.predict(
16
- prompt=prompt,
17
- base=base,
18
- motion=motion,
19
- step=step,
20
- api_name="/generate_image_1"
21
- )
22
- video_path = result["video"]
23
- return video_path
 
 
 
 
 
 
 
24
 
25
  # Gradio Interface
26
  with gr.Blocks(css="style.css") as demo:
 
12
 
13
  # Function
14
  def generate_image(prompt, base="Realistic", motion="", step=8, progress=gr.Progress()):
15
+ try:
16
+ result = client.predict(
17
+ prompt=prompt,
18
+ base=base,
19
+ motion=motion,
20
+ step=step,
21
+ api_name="/generate_image_1"
22
+ )
23
+ video_path = result["video"]
24
+ return video_path
25
+ except ValueError as e:
26
+ # Handle GPU quota exceeded error
27
+ if 'You have exceeded your GPU quota' in str(e):
28
+ return "Error: GPU quota exceeded. Please retry later."
29
+ else:
30
+ return f"Error: {str(e)}"
31
 
32
  # Gradio Interface
33
  with gr.Blocks(css="style.css") as demo: