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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -3
app.py CHANGED
@@ -2,6 +2,7 @@ import gradio as gr
2
  import os
3
  from gradio_client import Client
4
  import time
 
5
 
6
 
7
  MORE = """ ## TRY Other Models
@@ -31,10 +32,28 @@ def generate_image(prompt, base="Anime", motion="", step=8, progress=gr.Progress
31
  raise gr.Info(f"Ошибка подключения. Попытка {i+1} из {retries}.")
32
  time.sleep(5) # Пауза перед следующей попыткой
33
  raise gr.Error("Не удалось подключиться к API. Повторите попытку позже.")
34
-
35
- # Gradio Interface
36
- with gr.Blocks(css="style.css") as demo:
 
 
 
 
37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  with gr.Group():
39
  with gr.Row():
40
  prompt = gr.Textbox(
 
2
  import os
3
  from gradio_client import Client
4
  import time
5
+ import requests
6
 
7
 
8
  MORE = """ ## TRY Other Models
 
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"
38
+
39
+ # Получение CSS по ссылке
40
+ response = requests.get(css_url)
41
+ css = response.text
42
 
43
+ # Gradio Interface
44
+ with gr.Blocks(css=css) as demo:
45
+ gr.HTML(
46
+ """
47
+ <script>
48
+ var head = document.getElementsByTagName('head')[0];
49
+ var link = document.createElement('link');
50
+ link.rel = 'stylesheet';
51
+ link.type = 'text/css';
52
+ link.href = 'style.css';
53
+ head.appendChild(link);
54
+ </script>
55
+ """
56
+ )
57
  with gr.Group():
58
  with gr.Row():
59
  prompt = gr.Textbox(