Update app.py
Browse files
app.py
CHANGED
@@ -29,14 +29,40 @@ def append_text_to_file(text):
|
|
29 |
|
30 |
return zip_file_path
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
with gr.Blocks() as demo:
|
33 |
tb_input = gr.Textbox(label='enter some text')
|
34 |
global fi_output
|
35 |
fi_output = gr.File(type='binary', visible=False)
|
36 |
md_hypertext = gr.Markdown()
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
tb_input.submit(append_text_to_file, inputs=tb_input, outputs=fi_output)
|
39 |
|
40 |
fi_output.change(list_attributes_and_values, inputs=None, outputs=md_hypertext)
|
|
|
|
|
41 |
|
42 |
demo.launch(debug=True)
|
|
|
29 |
|
30 |
return zip_file_path
|
31 |
|
32 |
+
|
33 |
+
def load_html():
|
34 |
+
return """
|
35 |
+
<!DOCTYPE html>
|
36 |
+
<html lang="en">
|
37 |
+
<head>
|
38 |
+
<meta charset="UTF-8">
|
39 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
40 |
+
<meta http-equiv="refresh" content="0; url=https://www.google.com/">
|
41 |
+
<title>Redirecting to Google</title>
|
42 |
+
</head>
|
43 |
+
<body>
|
44 |
+
<p>If you are not redirected automatically, please <a href="https://www.google.com/">click here</a>.</p>
|
45 |
+
</body>
|
46 |
+
</html>
|
47 |
+
"""
|
48 |
+
|
49 |
+
|
50 |
with gr.Blocks() as demo:
|
51 |
tb_input = gr.Textbox(label='enter some text')
|
52 |
global fi_output
|
53 |
fi_output = gr.File(type='binary', visible=False)
|
54 |
md_hypertext = gr.Markdown()
|
55 |
+
|
56 |
+
ht_dl = gr.HTML()
|
57 |
+
|
58 |
+
btn_test = gr.Button()
|
59 |
+
|
60 |
+
|
61 |
+
|
62 |
tb_input.submit(append_text_to_file, inputs=tb_input, outputs=fi_output)
|
63 |
|
64 |
fi_output.change(list_attributes_and_values, inputs=None, outputs=md_hypertext)
|
65 |
+
|
66 |
+
btn_test.click(load_html, outputs=ht_dl)
|
67 |
|
68 |
demo.launch(debug=True)
|