Spaces:
Sleeping
Sleeping
Update ui/suggestions_tab.py
Browse files- ui/suggestions_tab.py +49 -11
ui/suggestions_tab.py
CHANGED
@@ -1,21 +1,59 @@
|
|
1 |
import gradio as gr
|
2 |
-
from smart_suggestion.flan_suggestor import generate_product_description
|
3 |
|
4 |
def create_suggestions_tab():
|
5 |
with gr.TabItem("π Smart Suggestions"):
|
6 |
-
gr.Markdown(
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
)
|
13 |
-
|
14 |
-
suggest_btn = gr.Button("π‘ Get Suggestions")
|
15 |
-
suggestions_output = gr.Textbox(label="π Suggestions", lines=10)
|
16 |
|
17 |
suggest_btn.click(
|
18 |
-
generate_product_description,
|
19 |
inputs=suggestion_input,
|
20 |
outputs=suggestions_output
|
21 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
from smart_suggestion.flan_suggestor import generate_product_description
|
3 |
|
4 |
def create_suggestions_tab():
|
5 |
with gr.TabItem("π Smart Suggestions"):
|
6 |
+
gr.Markdown(
|
7 |
+
"""
|
8 |
+
## π€ Ask RetailGenie for Recommendations
|
9 |
+
|
10 |
+
π§ Just type your need β e.g., _"shampoo for dry hair under 500"_, _"gift sets"_, or _"budget skin care"_
|
11 |
+
and let Genie do the rest!
|
12 |
+
""",
|
13 |
+
elem_classes="centered-text"
|
14 |
+
)
|
15 |
+
|
16 |
+
with gr.Box():
|
17 |
+
with gr.Row():
|
18 |
+
suggestion_input = gr.Textbox(
|
19 |
+
label="π¬ Your Request",
|
20 |
+
placeholder="Try: Gifts under 500, or Shampoo for dry hair",
|
21 |
+
lines=1,
|
22 |
+
scale=3
|
23 |
+
)
|
24 |
+
suggest_btn = gr.Button("π Get Suggestions", scale=1)
|
25 |
+
|
26 |
+
suggestions_output = gr.Textbox(
|
27 |
+
label="β¨ Suggested Products",
|
28 |
+
lines=10,
|
29 |
+
interactive=False,
|
30 |
+
show_copy_button=True,
|
31 |
+
elem_id="suggestion-box"
|
32 |
)
|
|
|
|
|
|
|
33 |
|
34 |
suggest_btn.click(
|
35 |
+
generate_product_description,
|
36 |
inputs=suggestion_input,
|
37 |
outputs=suggestions_output
|
38 |
)
|
39 |
+
|
40 |
+
gr.Markdown(
|
41 |
+
"""
|
42 |
+
<style>
|
43 |
+
.centered-text {
|
44 |
+
text-align: center;
|
45 |
+
font-size: 16px;
|
46 |
+
font-weight: 500;
|
47 |
+
}
|
48 |
+
#suggestion-box textarea {
|
49 |
+
font-family: 'Courier New', monospace;
|
50 |
+
font-size: 14px;
|
51 |
+
background-color: #111827;
|
52 |
+
color: #e5e7eb;
|
53 |
+
border-radius: 10px;
|
54 |
+
padding: 10px;
|
55 |
+
}
|
56 |
+
</style>
|
57 |
+
""",
|
58 |
+
unsafe_allow_html=True
|
59 |
+
)
|