Spaces:
Paused
Paused
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
custom_css = """
|
| 4 |
+
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display&display=swap');
|
| 5 |
+
|
| 6 |
+
body {
|
| 7 |
+
font-family: 'Playfair Display', serif;
|
| 8 |
+
background: linear-gradient(135deg, #5D4037, #3E2723);
|
| 9 |
+
color: #f7f1e1;
|
| 10 |
+
margin: 0;
|
| 11 |
+
padding: 0;
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
/* コンテナの最大幅と中央寄せ */
|
| 15 |
+
.gradio-container {
|
| 16 |
+
max-width: 800px;
|
| 17 |
+
margin: auto;
|
| 18 |
+
padding: 20px;
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
/* 見出し */
|
| 22 |
+
h1 {
|
| 23 |
+
text-align: center;
|
| 24 |
+
font-size: 2.5rem;
|
| 25 |
+
margin-bottom: 1rem;
|
| 26 |
+
color: #d4af37;
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
/* ボタンのスタイル */
|
| 30 |
+
.gr-button {
|
| 31 |
+
background-color: #6f4e37;
|
| 32 |
+
color: white;
|
| 33 |
+
border: none;
|
| 34 |
+
padding: 10px 20px;
|
| 35 |
+
font-size: 1rem;
|
| 36 |
+
border-radius: 5px;
|
| 37 |
+
cursor: pointer;
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
/* テキストボックスとHTML表示領域のスタイル */
|
| 41 |
+
.gr-textbox, .gr-html {
|
| 42 |
+
background-color: #ffffff;
|
| 43 |
+
border-radius: 5px;
|
| 44 |
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
| 45 |
+
}
|
| 46 |
+
"""
|
| 47 |
+
|
| 48 |
+
def render_html(html_code):
|
| 49 |
+
# 入力された HTML コードをそのまま返す(gr.HTML がレンダリングします)
|
| 50 |
+
return html_code
|
| 51 |
+
|
| 52 |
+
with gr.Blocks(css=custom_css, title="Club Lounge HTML Renderer") as demo:
|
| 53 |
+
gr.Markdown("# Club Lounge HTML Renderer")
|
| 54 |
+
gr.Markdown("下のテキストボックスに HTML コードを入力すると、右側にレンダリング結果が表示されます。")
|
| 55 |
+
with gr.Row():
|
| 56 |
+
with gr.Column():
|
| 57 |
+
html_input = gr.Textbox(label="HTMLコードを入力してください", lines=10, placeholder="<h1>Hello, Club Lounge!</h1>")
|
| 58 |
+
render_btn = gr.Button("レンダリング")
|
| 59 |
+
with gr.Column():
|
| 60 |
+
html_display = gr.HTML(label="レンダリング結果")
|
| 61 |
+
render_btn.click(fn=render_html, inputs=html_input, outputs=html_display)
|
| 62 |
+
|
| 63 |
+
demo.launch()
|