Spaces:
Running
on
A10G
Running
on
A10G
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
import numpy as np
|
3 |
import tempfile
|
4 |
import imageio
|
@@ -13,10 +14,19 @@ pipe.enable_model_cpu_offload()
|
|
13 |
|
14 |
|
15 |
def create_image_caption(image_init):
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
def export_to_video(frames: np.ndarray, fps: int) -> str:
|
22 |
frames = np.clip((frames * 255), 0, 255).astype(np.uint8)
|
|
|
1 |
import gradio as gr
|
2 |
+
from gradio_client import Client, handle_file
|
3 |
import numpy as np
|
4 |
import tempfile
|
5 |
import imageio
|
|
|
14 |
|
15 |
|
16 |
def create_image_caption(image_init):
|
17 |
+
client = Client("fffiloni/CoCa-clone")
|
18 |
+
result = client.predict(
|
19 |
+
image=handle_file(image_init),
|
20 |
+
decoding_method="Nucleus sampling",
|
21 |
+
rep_penalty=1.2,
|
22 |
+
top_p=0.5,
|
23 |
+
min_seq_len=5,
|
24 |
+
seq_len=20,
|
25 |
+
api_name="/inference_caption"
|
26 |
+
)
|
27 |
+
print(f"cap: {result}")
|
28 |
+
|
29 |
+
return result
|
30 |
|
31 |
def export_to_video(frames: np.ndarray, fps: int) -> str:
|
32 |
frames = np.clip((frames * 255), 0, 255).astype(np.uint8)
|