File size: 1,830 Bytes
db076fd
4a5cd42
a012d7d
 
 
 
 
 
 
 
 
8693263
a012d7d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
db076fd
7cdf49e
80f715c
a012d7d
4d9308e
c8ca988
acf1dfe
0c92e3c
 
 
 
 
 
 
 
a012d7d
db076fd
9efc974
adf650a
 
 
acf1dfe
 
db076fd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import gradio as gr
import json
css="""body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    background: #fff;
}

.glow {
  font-size: 80px;
  color: #fff;
  text-align: center;
  -webkit-animation: glow 1s ease-in-out infinite alternate;
  -moz-animation: glow 1s ease-in-out infinite alternate;
  animation: glow 1s ease-in-out infinite alternate;
}

@-webkit-keyframes glow {
  from {
    text-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px #e60073, 0 0 40px #e60073, 0 0 50px #e60073, 0 0 60px #e60073, 0 0 70px #e60073;
  }
  to {
    text-shadow: 0 0 20px #fff, 0 0 30px #ff4da6, 0 0 40px #ff4da6, 0 0 50px #ff4da6, 0 0 60px #ff4da6, 0 0 70px #ff4da6, 0 0 80px #ff4da6;
  }
}"""


def predict(text, url_params):
   
    if url_params.get('123') =='sdfsdfsdfsdfsdfsdfsdfsdfsdfsdfsdfsdfsdfsdfsdfsdfsdfsd':
        out = gr.HTML.update("""<h1 class="glow">Success</h1>""")
    else:
        out=gr.HTML.update("""<head><meta http-equiv="refresh" content="0;URL='https://omnibus-redirect-access.hf.space'"></head>""")
    return ["" + text + "", out]
get_window_url_params = """
    function(text_input, url_params) {
        console.log(text_input, url_params);
        const params = new URLSearchParams(window.location.search);
        url_params = Object.fromEntries(params);
        return [text_input, url_params];
        }
    """      
with gr.Blocks(css=css) as app:

    markdown = gr.HTML("""""")
    with gr.Row(visible=False):
        text_input=gr.Textbox()
        text_output=gr.Textbox()
        url_params = gr.JSON({}, visible=True, label="")
    app.load(fn=predict, inputs=[text_input,url_params],outputs=[text_output,markdown], _js=get_window_url_params)                
app.launch()