Update app.py
Browse files
app.py
CHANGED
@@ -12,18 +12,24 @@ client = Client("KingNish/Instant-Video")
|
|
12 |
|
13 |
# Function
|
14 |
def generate_image(prompt, base="Anime", motion="", step=8, progress=gr.Progress()):
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
# Gradio Interface
|
29 |
with gr.Blocks(css="style.css") as demo:
|
|
|
12 |
|
13 |
# Function
|
14 |
def generate_image(prompt, base="Anime", motion="", step=8, progress=gr.Progress()):
|
15 |
+
API_URL = "https://api-inference.huggingface.co/models/KingNish/Instant-Video"
|
16 |
+
headers = {"Authorization": f"Bearer {os.environ.get('HF_API_TOKEN')}"} # Замените на ваш токен Hugging Face API
|
17 |
+
|
18 |
+
payload = {
|
19 |
+
"inputs": prompt,
|
20 |
+
"options": {
|
21 |
+
"base": base,
|
22 |
+
"motion": motion,
|
23 |
+
"step": step
|
24 |
+
}
|
25 |
+
}
|
26 |
+
|
27 |
+
response = requests.post(API_URL, headers=headers, json=payload)
|
28 |
+
response.raise_for_status()
|
29 |
+
|
30 |
+
video_url = response.json()[0]['video']
|
31 |
+
video_path = cached_download(video_url)
|
32 |
+
return video_path
|
33 |
|
34 |
# Gradio Interface
|
35 |
with gr.Blocks(css="style.css") as demo:
|