Update app.py
Browse files
app.py
CHANGED
@@ -33,136 +33,26 @@ models=[
|
|
33 |
#o = os.getenv("P")
|
34 |
o = "V"
|
35 |
|
36 |
-
t_out = ("""
|
37 |
-
|
38 |
-
<link href="https://fonts.googleapis.com/css2?family=Poppins&display=swap" rel="stylesheet">
|
39 |
-
<!--Stylesheets-->
|
40 |
-
<style media="screen">
|
41 |
-
*,
|
42 |
-
*:before,
|
43 |
-
*:after{
|
44 |
-
padding: 0;
|
45 |
-
margin: 0;
|
46 |
-
box-sizing: border-box;
|
47 |
-
}
|
48 |
-
|
49 |
-
#container{
|
50 |
-
position: fixed;
|
51 |
-
width: 100%;
|
52 |
-
height: 100%;
|
53 |
-
top: 50%;
|
54 |
-
left: 50%;
|
55 |
-
z-index:19999;
|
56 |
-
background: #ff000059;
|
57 |
-
|
58 |
-
}
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
.popup{
|
66 |
-
background-color: #ffffff;
|
67 |
-
width: 420px;
|
68 |
-
padding: 30px 40px;
|
69 |
-
transform: translate(-50%,-50%);
|
70 |
-
left: 50%;
|
71 |
-
top: 50%;
|
72 |
-
border-radius: 8px;
|
73 |
-
font-family: "Poppins",sans-serif;
|
74 |
-
text-align: center;
|
75 |
-
position: fixed;
|
76 |
-
width: 200px;
|
77 |
-
height: 200px;
|
78 |
-
top: 0px;
|
79 |
-
left: 0px;
|
80 |
-
z-index:199999;
|
81 |
-
}
|
82 |
-
.popup button{
|
83 |
-
display: block;
|
84 |
-
margin: 0 0 20px auto;
|
85 |
-
background-color: transparent;
|
86 |
-
font-size: 30px;
|
87 |
-
color: #ffffff;
|
88 |
-
background: #03549a;
|
89 |
-
border-radius: 100%;
|
90 |
-
width: 40px;
|
91 |
-
height: 40px;
|
92 |
-
border: none;
|
93 |
-
outline: none;
|
94 |
-
cursor: pointer;
|
95 |
-
}
|
96 |
-
.popup h2{
|
97 |
-
margin-top: -20px;
|
98 |
-
}
|
99 |
-
.popup p{
|
100 |
-
font-size: 14px;
|
101 |
-
text-align: justify;
|
102 |
-
margin: 20px 0;
|
103 |
-
line-height: 25px;
|
104 |
-
}
|
105 |
-
|
106 |
-
</style>
|
107 |
-
|
108 |
-
<div id="container">
|
109 |
-
<div class="popup">
|
110 |
-
<button id="close">×</button>
|
111 |
-
<h2>Max Loading Time Reached</h2>
|
112 |
-
<p><center>
|
113 |
-
Click to Continue, or use a simplier Prompt
|
114 |
-
</center>
|
115 |
-
</p>
|
116 |
-
<a href="#">Let's Go</a>
|
117 |
-
</div>
|
118 |
-
</div>
|
119 |
-
<!--Script-->
|
120 |
-
<script type="text/javascript">
|
121 |
-
window.addEventListener("load", function(){
|
122 |
-
setTimeout(
|
123 |
-
function open(event){
|
124 |
-
document.querySelector(".popup").style.display = "block";
|
125 |
-
},
|
126 |
-
2000
|
127 |
-
)
|
128 |
-
});
|
129 |
-
|
130 |
-
|
131 |
-
document.querySelector("#close").addEventListener("click", function(){
|
132 |
-
document.querySelector(".popup").style.display = "none";
|
133 |
-
});
|
134 |
-
</script>
|
135 |
-
|
136 |
-
""")
|
137 |
m_out = ("""
|
138 |
-
|
139 |
-
|
140 |
<div id="restart">
|
141 |
<h3 id="head">Loading Time Limit Reached.</h3><br>
|
142 |
-
<h4 id="cont">Please
|
143 |
</div>
|
144 |
-
|
145 |
""")
|
146 |
|
147 |
def ac():
|
148 |
def clear():
|
149 |
return gr.update(value=0),gr.update(value=0)
|
150 |
def start():
|
151 |
-
print ("start")
|
152 |
stamp = time.time()
|
153 |
return gr.update(value=stamp),gr.update(value=0)
|
154 |
def end(stamp):
|
155 |
-
ts = stamp +
|
156 |
ti = time.time()
|
157 |
if ti > ts and stamp != 0:
|
158 |
-
print("Cancelling")
|
159 |
return gr.update(value=1),gr.HTML.update(f"{m_out}", visible=True)
|
160 |
-
#return gr.update(value=1)
|
161 |
-
|
162 |
else:
|
163 |
-
print("Passing")
|
164 |
return gr.update(value=0),None
|
165 |
-
|
166 |
def im_fn(put,fac="",h=None):
|
167 |
if h == o:
|
168 |
put = f"{put}{fac}"
|
|
|
33 |
#o = os.getenv("P")
|
34 |
o = "V"
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
m_out = ("""
|
|
|
|
|
37 |
<div id="restart">
|
38 |
<h3 id="head">Loading Time Limit Reached.</h3><br>
|
39 |
+
<h4 id="cont">Please choose a Simpler Prompt, or <a href="#upgrade" style="text-decoration:None"><b>Upgrade</b></a></h4>
|
40 |
</div>
|
|
|
41 |
""")
|
42 |
|
43 |
def ac():
|
44 |
def clear():
|
45 |
return gr.update(value=0),gr.update(value=0)
|
46 |
def start():
|
|
|
47 |
stamp = time.time()
|
48 |
return gr.update(value=stamp),gr.update(value=0)
|
49 |
def end(stamp):
|
50 |
+
ts = stamp + 120
|
51 |
ti = time.time()
|
52 |
if ti > ts and stamp != 0:
|
|
|
53 |
return gr.update(value=1),gr.HTML.update(f"{m_out}", visible=True)
|
|
|
|
|
54 |
else:
|
|
|
55 |
return gr.update(value=0),None
|
|
|
56 |
def im_fn(put,fac="",h=None):
|
57 |
if h == o:
|
58 |
put = f"{put}{fac}"
|