Spaces:
Running
Running
Update app.py
Browse files
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 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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:
|