Parishri07 commited on
Commit
76c6f72
Β·
verified Β·
1 Parent(s): f54b375

Update ui/suggestions_tab.py

Browse files
Files changed (1) hide show
  1. 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 # Updated import
3
 
4
  def create_suggestions_tab():
5
  with gr.TabItem("🎁 Smart Suggestions"):
6
- gr.Markdown("### πŸ€– Ask RetailGenie for Recommendations")
7
-
8
- suggestion_input = gr.Textbox(
9
- label="Ask something like:",
10
- placeholder="e.g. Shampoo under 500 for dry hair",
11
- lines=1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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, # Updated function
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
+ )