Rooni commited on
Commit
8cf4129
1 Parent(s): 44f5493

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -17
app.py CHANGED
@@ -15,23 +15,20 @@ client = Client("KingNish/Instant-Video")
15
 
16
  # Function
17
  def generate_image(prompt, base="Anime", motion="", step=8, progress=gr.Progress()):
18
- retries = 3
19
- for i in range(retries):
20
- try:
21
- result = client.predict(
22
- prompt=prompt,
23
- base=base,
24
- motion=motion,
25
- step=step,
26
- api_name="/generate_image_1"
27
- )
28
- video_path = result["video"]
29
- return video_path
30
- except ValueError as e:
31
- print(f"Ошибка подключения. Попытка {i+1} из {retries}.")
32
- raise gr.Info(f"Ошибка подключения. Попытка {i+1} из {retries}.")
33
- time.sleep(5) # Пауза перед следующей попыткой
34
- raise gr.Error("Не удалось подключиться к API. Повторите попытку позже.")
35
 
36
  # Ссылка на файл CSS
37
  css_url = "https://aihubyufi-aihub.static.hf.space/style.css"
 
15
 
16
  # Function
17
  def generate_image(prompt, base="Anime", motion="", step=8, progress=gr.Progress()):
18
+ try:
19
+ result = client.predict(
20
+ prompt=prompt,
21
+ base=base,
22
+ motion=motion,
23
+ step=step,
24
+ api_name="/generate_image_1"
25
+ )
26
+ video_path = result["video"]
27
+ return video_path
28
+ except ValueError as e:
29
+ print(f"Ошибка подключения.")
30
+ raise gr.Error("Не удалось подключиться к API. Повторите попытку позже.")
31
+
 
 
 
32
 
33
  # Ссылка на файл CSS
34
  css_url = "https://aihubyufi-aihub.static.hf.space/style.css"