File size: 4,420 Bytes
fafd697
3458512
29576cb
3458512
 
 
e124e84
ddae7a5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3458512
 
 
 
 
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
import gradio as gr
from agent import workflow

def generate(topic, platform):
    post, engagement, tone, clarity = workflow(topic, platform)
    return post, engagement, tone, clarity

css = """
/* Gradient background */
body {
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #2d3748;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Glassmorphism container */
.gradio-container {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    padding: 3rem 3.5rem;
    width: 95%;
    max-width: 960px;
    color: #1a202c;
    border: 1px solid rgba(255, 255, 255, 0.18);
}

/* Title with underline */
#title {
    font-size: 3rem;
    font-weight: 900;
    text-align: center;
    color: #fff;
    letter-spacing: 1.4px;
    margin-bottom: 0.3rem;
    text-shadow: 0 2px 6px rgba(0,0,0,0.25);
    position: relative;
}

#title::after {
    content: "";
    display: block;
    width: 80px;
    height: 3px;
    background: #f6ad55;
    margin: 12px auto 0;
    border-radius: 2px;
}

/* Subtitle style */
#subtitle {
    font-size: 1.2rem;
    font-weight: 600;
    color: #e2e8f0dd;
    text-align: center;
    margin-bottom: 2.5rem;
    font-style: italic;
    text-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* Labels */
.input-label, .output-label {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: #e2e8f0dd;
}

/* Input styling with icon placeholder */
input[type="text"], textarea {
    width: 100%;
    padding: 14px 18px;
    font-size: 1rem;
    border: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.85);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
    transition: box-shadow 0.3s ease, background 0.3s ease;
    color: #2d3748;
}

input[type="text"]:focus, textarea:focus {
    outline: none;
    background: #fff;
    box-shadow: 0 0 12px 2px #f6ad55;
}

/* Readonly output styling */
textarea[readonly], input[readonly] {
    background: rgba(255, 255, 255, 0.7);
    color: #2d3748;
    resize: vertical;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

/* Button styling with animation */
.gr-button {
    width: 100%;
    padding: 16px 0;
    background: linear-gradient(45deg, #f6ad55, #d69e2e);
    border: none;
    border-radius: 14px;
    color: #fff;
    font-weight: 700;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 8px 15px rgba(246,173,85,0.4);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    margin-top: 2rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.gr-button:hover {
    box-shadow: 0 12px 20px rgba(246,173,85,0.65);
    transform: translateY(-3px);
}

/* Layout for rows and columns */
.gr-row {
    gap: 2.5rem;
}

/* Output boxes spacing */
.gr-row > .gradio-textbox {
    margin-top: 1.3rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .gradio-container {
        padding: 2rem 2rem;
    }
    .gr-row {
        flex-direction: column;
        gap: 2rem;
    }
}
"""

with gr.Blocks(css=css) as demo:
    gr.Markdown(
        """
        <div id="title">Social Media Post Generator</div>
        <div id="subtitle">Craft professional, clear, and engaging posts tailored to your platform.</div>
        """
    )

    with gr.Row():
        with gr.Column(scale=1):
            topic_input = gr.Textbox(label="Topic", placeholder="Enter your topic here")
            platform_input = gr.Textbox(label="Platform", placeholder="E.g., LinkedIn, Twitter")
            generate_btn = gr.Button("Generate Post")

        with gr.Column(scale=1):
            post_output = gr.Textbox(label="Generated Post", lines=8, interactive=False)
            engagement_output = gr.Textbox(label="Engagement Score", interactive=False)
            tone_output = gr.Textbox(label="Tone Score", interactive=False)
            clarity_output = gr.Textbox(label="Clarity Score", interactive=False)

    generate_btn.click(fn=generate, inputs=[topic_input, platform_input], outputs=[post_output, engagement_output, tone_output, clarity_output])

if __name__ == "__main__":
    demo.launch()