File size: 1,126 Bytes
085880a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr

def combine_inputs(title, content):
    # Create a simple HTML template with the inputs
    html = f"""
    <div style="font-family: Arial, sans-serif; max-width: 800px; margin: 0 auto; padding: 20px;">
        <h1 style="color: #2c3e50;">{title}</h1>
        <div style="background-color: #f7f9fc; padding: 15px; border-radius: 8px;">
            <p style="line-height: 1.6;">{content}</p>
        </div>
        <footer style="margin-top: 20px; color: #7f8c8d; font-size: 0.9em;">
            Generated with Gradio
        </footer>
    </div>
    """
    return html

# Create the interface
with gr.Blocks() as demo:
    gr.Markdown("# HTML Generator")
    
    with gr.Row():
        title_input = gr.Textbox(label="Title", placeholder="Enter your title here")
        content_input = gr.Textbox(label="Content", placeholder="Enter your content here", lines=3)
    
    generate_btn = gr.Button("Generate HTML")
    output = gr.HTML(label="Generated HTML")
    
    generate_btn.click(
        fn=combine_inputs,
        inputs=[title_input, content_input],
        outputs=output
    )

demo.launch()