JatinkInnovision commited on
Commit
e621e7d
Β·
verified Β·
1 Parent(s): 2bbdb67

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +44 -28
app.py CHANGED
@@ -11,27 +11,38 @@ is_comfit_alive = False
11
  clean_link = "comfit-copilot.mch250095.projects.jetstream-cloud.org:3000"
12
  full_url = f"http://{clean_link}"
13
 
14
- # Styled HTML for the American Flag themed button
15
- AMERICAN_FLAG_LINK = f"""
16
- <div style="text-align: center; margin: 20px 0;">
17
- <a href="{full_url}" target="_blank" style="
18
- display: inline-block;
19
- padding: 15px 30px;
20
- font-size: 24px;
21
- font-weight: bold;
22
- text-decoration: none;
23
- color: white;
24
- background: linear-gradient(90deg, #B22234 33%, #FFFFFF 33%, #FFFFFF 66%, #3C3B6E 66%);
25
- background-size: 300% 100%;
26
- border: 4px solid #3C3B6E;
27
- border-radius: 10px;
28
- text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
29
- box-shadow: 0 4px 15px rgba(0,0,0,0.3);
30
- transition: transform 0.2s;
31
- " onmouseover="this.style.transform='scale(1.05)'" onmouseout="this.style.transform='scale(1)'">
32
- <span style="color: #FFFFFF; background-color: #B22234; padding: 2px 5px; border-radius: 3px;">πŸ‡ΊπŸ‡Έ</span>
33
- <span style="color: #3C3B6E;">Click here for ComFit Copilot</span>
34
- <span style="color: #FFFFFF; background-color: #3C3B6E; padding: 2px 5px; border-radius: 3px;">πŸ‡ΊπŸ‡Έ</span>
 
 
 
 
 
 
 
 
 
 
 
35
  </a>
36
  </div>
37
  """
@@ -75,7 +86,7 @@ def get_current_status():
75
  else:
76
  is_comfit_alive = False
77
 
78
- link_update = gr.update(value=AMERICAN_FLAG_LINK if is_comfit_alive else "", visible=is_comfit_alive)
79
  return status_text, f"πŸ‘₯ Active Users: {active_user_count}", link_update
80
  except Exception as e:
81
  return f"❌ Error: {str(e)}", f"πŸ‘₯ Active Users: {active_user_count}", gr.update()
@@ -112,7 +123,7 @@ def manage_instance():
112
  try:
113
  if requests.get(full_url, timeout=3).status_code < 500:
114
  is_comfit_alive = True
115
- yield ("πŸŽ‰ Success! ComFit is ready.", gr.update(value=AMERICAN_FLAG_LINK, visible=True))
116
  return
117
  except: pass
118
  yield (f"πŸ”„ Milestone 3/3: Software booting ({i+1}/24)...", gr.update(visible=False))
@@ -131,10 +142,7 @@ function playNotification(status) {
131
  }
132
  }
133
  function resetTimer() { idleTime = 0; }
134
- window.onmousemove = resetTimer;
135
- window.onmousedown = resetTimer;
136
- window.onclick = resetTimer;
137
- window.onkeypress = resetTimer;
138
  setInterval(function() {
139
  idleTime++;
140
  if (idleTime >= MAX_IDLE) {
@@ -161,7 +169,7 @@ with gr.Blocks() as demo:
161
 
162
  status_label = gr.Label(value="Ready")
163
 
164
- # Logic Change: Use gr.HTML for the link instead of Markdown to hide the URL and center it
165
  link_box = gr.HTML(visible=False)
166
 
167
  gr.Markdown("---")
@@ -186,6 +194,14 @@ with gr.Blocks() as demo:
186
  Once you sign-up using your email, a button will pop-up showing that you need to confirm email. You can safely ignore this step and continue with login using information you just used for sign-up.
187
  """)
188
 
 
 
 
 
 
 
 
 
189
  live_status.change(None, inputs=live_status, js="(s) => playNotification(s)")
190
  activate_btn.click(fn=manage_instance, outputs=[status_label, link_box])
191
  refresh_btn.click(fn=get_current_status, outputs=[live_status, user_display, link_box])
 
11
  clean_link = "comfit-copilot.mch250095.projects.jetstream-cloud.org:3000"
12
  full_url = f"http://{clean_link}"
13
 
14
+ # Styled HTML for a flashing green block with black text
15
+ GREEN_FLASHING_LINK = f"""
16
+ <style>
17
+ @keyframes flash {{
18
+ 0% {{ opacity: 1; }}
19
+ 50% {{ opacity: 0.4; }}
20
+ 100% {{ opacity: 1; }}
21
+ }}
22
+ .flashing-btn {{
23
+ display: inline-block;
24
+ padding: 20px 40px;
25
+ font-size: 26px;
26
+ font-weight: 900;
27
+ text-decoration: none;
28
+ color: black !important;
29
+ background-color: #39FF14;
30
+ border: 5px solid black;
31
+ border-radius: 4px;
32
+ text-align: center;
33
+ animation: flash 1s infinite;
34
+ box-shadow: 0 0 20px #39FF14;
35
+ transition: transform 0.2s;
36
+ }}
37
+ .flashing-btn:hover {{
38
+ animation: none;
39
+ transform: scale(1.05);
40
+ opacity: 1;
41
+ }}
42
+ </style>
43
+ <div style="text-align: center; margin: 30px 0;">
44
+ <a href="{full_url}" target="_blank" class="flashing-btn">
45
+ CLICK HERE FOR COMFIT COPILOT
46
  </a>
47
  </div>
48
  """
 
86
  else:
87
  is_comfit_alive = False
88
 
89
+ link_update = gr.update(value=GREEN_FLASHING_LINK if is_comfit_alive else "", visible=is_comfit_alive)
90
  return status_text, f"πŸ‘₯ Active Users: {active_user_count}", link_update
91
  except Exception as e:
92
  return f"❌ Error: {str(e)}", f"πŸ‘₯ Active Users: {active_user_count}", gr.update()
 
123
  try:
124
  if requests.get(full_url, timeout=3).status_code < 500:
125
  is_comfit_alive = True
126
+ yield ("πŸŽ‰ Success! ComFit is ready.", gr.update(value=GREEN_FLASHING_LINK, visible=True))
127
  return
128
  except: pass
129
  yield (f"πŸ”„ Milestone 3/3: Software booting ({i+1}/24)...", gr.update(visible=False))
 
142
  }
143
  }
144
  function resetTimer() { idleTime = 0; }
145
+ window.onmousemove = resetTimer; window.onmousedown = resetTimer; window.onclick = resetTimer; window.onkeypress = resetTimer;
 
 
 
146
  setInterval(function() {
147
  idleTime++;
148
  if (idleTime >= MAX_IDLE) {
 
169
 
170
  status_label = gr.Label(value="Ready")
171
 
172
+ # Flashing link box above instructions
173
  link_box = gr.HTML(visible=False)
174
 
175
  gr.Markdown("---")
 
194
  Once you sign-up using your email, a button will pop-up showing that you need to confirm email. You can safely ignore this step and continue with login using information you just used for sign-up.
195
  """)
196
 
197
+ # Logo Footer Section
198
+ gr.Markdown("---")
199
+ gr.Markdown("<center><h3>Supported By</h3></center>")
200
+ with gr.Row():
201
+ gr.Image("logo1.png", show_label=False, interactive=False, container=False, scale=1)
202
+ gr.Image("logo2.png", show_label=False, interactive=False, container=False, scale=1)
203
+ gr.Image("logo3.png", show_label=False, interactive=False, container=False, scale=1)
204
+
205
  live_status.change(None, inputs=live_status, js="(s) => playNotification(s)")
206
  activate_btn.click(fn=manage_instance, outputs=[status_label, link_box])
207
  refresh_btn.click(fn=get_current_status, outputs=[live_status, user_display, link_box])