Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
# Function to generate greeting card content
|
4 |
+
def generate_card(name, message):
|
5 |
+
# HTML greeting card layout with inline CSS
|
6 |
+
html = f"""
|
7 |
+
<div style="background-image: url('https://i.imgur.com/lTxOZXL.jpg');
|
8 |
+
background-size: cover;
|
9 |
+
color: white;
|
10 |
+
height: 300px;
|
11 |
+
padding: 20px;
|
12 |
+
font-family: 'Segoe UI', sans-serif;
|
13 |
+
border-radius: 15px;
|
14 |
+
box-shadow: 0 0 20px rgba(0,0,0,0.3);
|
15 |
+
display: flex;
|
16 |
+
flex-direction: column;
|
17 |
+
justify-content: center;
|
18 |
+
text-align: center;">
|
19 |
+
<h1 style="font-size: 2.5em;">Salaam, {name}!</h1>
|
20 |
+
<p style="font-size: 1.5em;">{message}</p>
|
21 |
+
</div>
|
22 |
+
"""
|
23 |
+
return html
|
24 |
+
|
25 |
+
# Gradio interface using HTML output
|
26 |
+
demo = gr.Interface(
|
27 |
+
fn=generate_card,
|
28 |
+
inputs=[
|
29 |
+
gr.Textbox(label="Enter your name"),
|
30 |
+
gr.Textbox(label="Enter a custom message")
|
31 |
+
],
|
32 |
+
outputs=gr.HTML(label="Your Greeting Card"),
|
33 |
+
title="🌟 Greeting Card Generator",
|
34 |
+
description="Create a beautiful greeting card with a name and message. Powered by Gradio + HTML."
|
35 |
+
)
|
36 |
+
|
37 |
+
demo.launch()
|