prithivMLmods commited on
Commit
1f87440
·
verified ·
1 Parent(s): ae42467

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +44 -4
app.py CHANGED
@@ -9,10 +9,7 @@ import spaces
9
  import torch
10
  from diffusers import StableDiffusionXLPipeline, EulerAncestralDiscreteScheduler
11
 
12
-
13
- DESCRIPTIONx = """## STABLE HAMSTER
14
- """
15
-
16
 
17
  # Use environment variables for flexibility
18
  MODEL_ID = os.getenv("MODEL_REPO")
@@ -114,7 +111,50 @@ footer {
114
  }
115
  '''
116
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  with gr.Blocks(css=css, theme="bethecloud/storj_theme") as demo:
 
118
  gr.Markdown(DESCRIPTIONx)
119
  with gr.Group():
120
  with gr.Row():
 
9
  import torch
10
  from diffusers import StableDiffusionXLPipeline, EulerAncestralDiscreteScheduler
11
 
12
+ DESCRIPTIONx = """## STABLE HAMSTER"""
 
 
 
13
 
14
  # Use environment variables for flexibility
15
  MODEL_ID = os.getenv("MODEL_REPO")
 
111
  }
112
  '''
113
 
114
+ # Define the content of index.html with a loading animation and delay
115
+ index_html_content = """
116
+ <!DOCTYPE html>
117
+ <html lang="en">
118
+ <head>
119
+ <meta charset="UTF-8">
120
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
121
+ <title>Loading...</title>
122
+ <style>
123
+ /* Define your loading animation CSS here */
124
+ .loading-animation {
125
+ /* Example styles */
126
+ width: 100px;
127
+ height: 100px;
128
+ background-color: #f0f0f0;
129
+ border-radius: 50%;
130
+ animation: spin 2s linear infinite;
131
+ margin: 100px auto;
132
+ }
133
+ @keyframes spin {
134
+ 0% { transform: rotate(0deg); }
135
+ 100% { transform: rotate(360deg); }
136
+ }
137
+ </style>
138
+ </head>
139
+ <body>
140
+ <div class="loading-animation"></div>
141
+ <script>
142
+ // Delay for 5-6 seconds before transitioning to Gradio UI
143
+ setTimeout(function() {
144
+ window.location.href = '/'; // Redirect to Gradio UI
145
+ }, 5000); // Adjust time as needed (5000 = 5 seconds)
146
+ </script>
147
+ </body>
148
+ </html>
149
+ """
150
+
151
+ # Save index.html to the current directory
152
+ with open("index.html", "w") as f:
153
+ f.write(index_html_content)
154
+
155
+ # Embed index.html into Gradio UI
156
  with gr.Blocks(css=css, theme="bethecloud/storj_theme") as demo:
157
+ gr.HTML(index_html_content) # Embed the HTML content here
158
  gr.Markdown(DESCRIPTIONx)
159
  with gr.Group():
160
  with gr.Row():