Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,12 +1,15 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import
|
| 3 |
-
from gradio_client import Client, APIError
|
| 4 |
-
import time
|
| 5 |
import requests
|
| 6 |
from deep_translator import GoogleTranslator
|
| 7 |
from langdetect import detect
|
| 8 |
import re
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
# Gradio Client
|
| 11 |
client = Client("KingNish/Instant-Video")
|
| 12 |
|
|
@@ -28,17 +31,14 @@ def generate_image(prompt, base="Anime", motion="", step=8, progress=gr.Progress
|
|
| 28 |
)
|
| 29 |
video_path = result["video"]
|
| 30 |
return video_path
|
| 31 |
-
except
|
| 32 |
error_message = str(e)
|
| 33 |
match = re.search(r'You have exceeded your GPU quota \((\d+:\d+:\d+) left vs. \d+s requested\). Please retry in (\d+:\d+:\d+)\.', error_message)
|
| 34 |
if match:
|
| 35 |
wait_time = match.group(2)
|
| 36 |
-
raise gr.Error(f"У модели сработало ограничение (Слишком часто), попробуйте ещё раз в {wait_time}")
|
| 37 |
else:
|
| 38 |
-
raise gr.Error("Произошла ошибка при подключении к API. Повторите попытку позже или обратитесь к администраторам Neurix.")
|
| 39 |
-
except ValueError as e:
|
| 40 |
-
print(f"Ошибка подключения.")
|
| 41 |
-
raise gr.Error("Не удалось подключиться к API. Повторите попытку позже или обратитесь к администраторам Neurix.")
|
| 42 |
|
| 43 |
# Ссылка на файл CSS
|
| 44 |
css_url = "https://neurixyufi-aihub.static.hf.space/style.css"
|
|
@@ -126,4 +126,4 @@ with gr.Blocks(css=css) as demo:
|
|
| 126 |
outputs=video,
|
| 127 |
)
|
| 128 |
|
| 129 |
-
demo.queue(max_size=250).launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from gradio_client import Client
|
|
|
|
|
|
|
| 3 |
import requests
|
| 4 |
from deep_translator import GoogleTranslator
|
| 5 |
from langdetect import detect
|
| 6 |
import re
|
| 7 |
|
| 8 |
+
MORE = """ ## TRY Other Models
|
| 9 |
+
### JARVIS: Your VOICE Assistant -> https://huggingface.co/spaces/KingNish/JARVIS
|
| 10 |
+
### Instant Image: 4k images in 5 Second -> https://huggingface.co/spaces/KingNish/Instant-Image
|
| 11 |
+
"""
|
| 12 |
+
|
| 13 |
# Gradio Client
|
| 14 |
client = Client("KingNish/Instant-Video")
|
| 15 |
|
|
|
|
| 31 |
)
|
| 32 |
video_path = result["video"]
|
| 33 |
return video_path
|
| 34 |
+
except Exception as e:
|
| 35 |
error_message = str(e)
|
| 36 |
match = re.search(r'You have exceeded your GPU quota \((\d+:\d+:\d+) left vs. \d+s requested\). Please retry in (\d+:\d+:\d+)\.', error_message)
|
| 37 |
if match:
|
| 38 |
wait_time = match.group(2)
|
| 39 |
+
raise gr.Error(f"У модели сработало ограничение (Слишком часто), попробуйте ещё раз в *время: {wait_time}*")
|
| 40 |
else:
|
| 41 |
+
raise gr.Error(f"Произошла ошибка при подключении к API: {error_message}. Повторите попытку позже или обратитесь к администраторам Neurix.")
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
# Ссылка на файл CSS
|
| 44 |
css_url = "https://neurixyufi-aihub.static.hf.space/style.css"
|
|
|
|
| 126 |
outputs=video,
|
| 127 |
)
|
| 128 |
|
| 129 |
+
demo.queue(max_size=250).launch()
|