Update app.py
Browse files
app.py
CHANGED
@@ -101,20 +101,59 @@ def generate_product_description(image, description_type, custom_instruction=Non
|
|
101 |
return response_data["choices"][0]["message"]["content"]
|
102 |
|
103 |
|
|
|
104 |
css = """
|
|
|
|
|
|
|
|
|
|
|
105 |
#output {
|
106 |
height: 500px;
|
107 |
overflow: auto;
|
108 |
border: 1px solid #ccc;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
}
|
110 |
"""
|
111 |
|
112 |
with gr.Blocks(css=css) as demo:
|
113 |
-
gr.Markdown("WordLift Product Description Generation - [FREE]")
|
114 |
with gr.Tab(label="WordLift Product Description Generation"):
|
115 |
with gr.Row():
|
116 |
with gr.Column():
|
117 |
-
input_img = gr.Image(label="Input Picture")
|
118 |
description_type = gr.Dropdown(
|
119 |
label="Select Description Type",
|
120 |
choices=[
|
@@ -147,14 +186,14 @@ with gr.Blocks(css=css) as demo:
|
|
147 |
"Other",
|
148 |
],
|
149 |
value="Short Formal 📝",
|
|
|
150 |
)
|
151 |
custom_instruction = gr.Textbox(
|
152 |
-
label="Custom Instruction (Only for 'Other')", visible=False
|
153 |
)
|
154 |
-
submit_btn = gr.Button(value="Submit")
|
155 |
with gr.Column():
|
156 |
-
output_text = gr.Markdown(label="Output Text", show_copy_button=True)
|
157 |
-
|
158 |
|
159 |
# Toggle visibility of custom instruction based on selected type
|
160 |
def toggle_custom_instruction(type_selection):
|
@@ -174,4 +213,4 @@ with gr.Blocks(css=css) as demo:
|
|
174 |
|
175 |
# Launch Gradio app
|
176 |
demo.queue(api_open=False)
|
177 |
-
demo.launch(debug=True)
|
|
|
101 |
return response_data["choices"][0]["message"]["content"]
|
102 |
|
103 |
|
104 |
+
# Custom CSS to match WordLift style
|
105 |
css = """
|
106 |
+
body {
|
107 |
+
font-family: 'Inter', sans-serif;
|
108 |
+
background-color: #ffffff;
|
109 |
+
color: #333333;
|
110 |
+
}
|
111 |
#output {
|
112 |
height: 500px;
|
113 |
overflow: auto;
|
114 |
border: 1px solid #ccc;
|
115 |
+
padding: 20px;
|
116 |
+
font-size: 1.2em;
|
117 |
+
border-radius: 8px;
|
118 |
+
}
|
119 |
+
button, select, input[type="button"], input[type="submit"] {
|
120 |
+
background-color: #0056d2; /* WordLift blue */
|
121 |
+
color: white;
|
122 |
+
border-radius: 8px;
|
123 |
+
padding: 10px 20px;
|
124 |
+
border: none;
|
125 |
+
font-size: 1em;
|
126 |
+
cursor: pointer;
|
127 |
+
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
|
128 |
+
}
|
129 |
+
button:hover, select:hover, input[type="button"]:hover, input[type="submit"]:hover {
|
130 |
+
background-color: #003da1; /* Darker shade of WordLift blue */
|
131 |
+
}
|
132 |
+
.gr-box {
|
133 |
+
border: 1px solid #e1e1e1;
|
134 |
+
border-radius: 8px;
|
135 |
+
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.05);
|
136 |
+
padding: 20px;
|
137 |
+
}
|
138 |
+
.gr-block {
|
139 |
+
margin-bottom: 20px;
|
140 |
+
}
|
141 |
+
.output-text {
|
142 |
+
font-size: 1.4em;
|
143 |
+
color: #000000;
|
144 |
+
padding: 15px;
|
145 |
+
border-radius: 8px;
|
146 |
+
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
|
147 |
+
border: 1px solid #e1e1e1;
|
148 |
}
|
149 |
"""
|
150 |
|
151 |
with gr.Blocks(css=css) as demo:
|
152 |
+
gr.Markdown("<h1>WordLift Product Description Generation - [FREE]</h1>")
|
153 |
with gr.Tab(label="WordLift Product Description Generation"):
|
154 |
with gr.Row():
|
155 |
with gr.Column():
|
156 |
+
input_img = gr.Image(label="Input Picture", elem_classes="gr-box")
|
157 |
description_type = gr.Dropdown(
|
158 |
label="Select Description Type",
|
159 |
choices=[
|
|
|
186 |
"Other",
|
187 |
],
|
188 |
value="Short Formal 📝",
|
189 |
+
elem_classes="gr-box"
|
190 |
)
|
191 |
custom_instruction = gr.Textbox(
|
192 |
+
label="Custom Instruction (Only for 'Other')", visible=False, elem_classes="gr-box"
|
193 |
)
|
194 |
+
submit_btn = gr.Button(value="Submit", elem_classes="gr-box")
|
195 |
with gr.Column():
|
196 |
+
output_text = gr.Markdown(label="Output Text", show_copy_button=True, elem_classes="output-text")
|
|
|
197 |
|
198 |
# Toggle visibility of custom instruction based on selected type
|
199 |
def toggle_custom_instruction(type_selection):
|
|
|
213 |
|
214 |
# Launch Gradio app
|
215 |
demo.queue(api_open=False)
|
216 |
+
demo.launch(debug=True)
|