aditi2222 commited on
Commit
a082fed
1 Parent(s): d95c20a

Create new file

Browse files
Files changed (1) hide show
  1. app.py +81 -0
app.py ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #vitamin D
2
+ def get_correct_desc(input_text):
3
+
4
+ if input_text == "There was no fish taste":
5
+ text1 = "This supplement works great and is tasteless."
6
+ text2 = "These are a great supplement and I feel like they help me stay more energetic regularly. They are easy to take and have an excellent taste/smell. The ingredients are quality as well! These vitamins helped me when I was having difficulty with sleep, in my opinion, although it's quite subjective."
7
+ text3 = "Supports Healthy Bones & Teeth."
8
+
9
+ elif input_text == "I liked it":
10
+ text1 = "This supplement has many benefits."
11
+ text2 = "I'm a Vegan, very active in my diet, and I've been taking this vitamin for over 4 months. There's been a noticeable improvement in my health and energy levels on top of the well-documented benefits of Vitamins. Highly recommend!"
12
+ text3 = "Supports Healthy Immune System Function."
13
+
14
+ else:
15
+ text1 = "I feel amazing after using this product."
16
+ text2 = "My name is Jessica, I've been taking this vitamin for the last few days and it's been amazing. It has increased my energy, made me feel stronger, helped improve my mood, immune system and overall well being. I would recommend this product to anyone who needs a little boost in their health and quality of life."
17
+ text3 = "Formulated to Contain: No Gluten, No GMOs, No Soy."
18
+
19
+ return text1, text2, text3
20
+
21
+
22
+ #Ashwagandha Extract
23
+ def get_correct_desc1(input_text1):
24
+
25
+ if input_text1 == "Helped with my energy levels":
26
+ text4 = "This supplement works great and is tasteless."
27
+ text5 = "I've tried two other ashwagandha brands (Jarrow Formulas and Himalaya and think this one is the strongest. They're all pretty good though. You can feel the calming relaxing effects in about 10 minutes. Great for getting to sleep. When I use it daily, (for the overall tonic and pro-thyroid effects)I find the relaxing effects wear off. For better sleep, I just stop using it for a couple of days and start again. I really like ashwagandha, and this brand."
28
+ text6 = "Free Radical Scavenger"
29
+
30
+ elif input_text1 == "No Smell":
31
+ text4 = "This supplement has many benefits."
32
+ text5 = "Ashwaghanda can smell bad but this product has no odor at all, which makes it easy to take."
33
+ text6 = "Immune System Support"
34
+
35
+ else:
36
+ text4 = "I feel amazing after using this product."
37
+ text5 = "Gives me a good night's sleep without feeling hungover in the morning."
38
+ text6 = "Non-GMO"
39
+ import gradio as gr
40
+
41
+ demo = gr.Blocks()
42
+
43
+
44
+ image = """
45
+ <center>
46
+ <img src="https://www.springml.com/wp-content/uploads/2018/01/SpringML-Logo-200x50-1.png" width=200px>
47
+ </center>
48
+ """
49
+
50
+ with demo:
51
+ gr.Markdown(image)
52
+ with gr.Tabs():
53
+ with gr.TabItem("Vitamin D"):
54
+ with gr.Row():
55
+ #input object 1
56
+ in1 = gr.Dropdown(["There was no fish taste", "I liked it" ,"I feel better"])
57
+ #output object1
58
+ out1 = gr.Textbox(label = "Key Phase Choice" , show_label = True)
59
+ #output object 2
60
+ out2= gr.Textbox(label="Helpful Review", show_label = True)
61
+ #output object 3
62
+ out3 = gr.Textbox(label="Product Descriptor", line = 7 , show_label = True)
63
+ text_button = gr.Button("Select the option from dropdown option and then click here")
64
+
65
+ with gr.TabItem("Ashwagandha Extract"):
66
+ with gr.Row():
67
+ #input object 2
68
+ in2 = gr.Dropdown(["Helped with my energy levels", "No Smell" ,"Helped with sleep"])
69
+ #output object 4
70
+ out4 = gr.Textbox(label = "Key Phase Choice" , show_label = True,lines = 2)
71
+ #output object 5
72
+ out5= gr.Textbox(label="Helpful Review", show_label = True,lines = 2,max_lines=99)
73
+ #output object 6
74
+ out6 = gr.Textbox(label="Product Descriptor", line = 2 , show_label = True)
75
+ text_button1 = gr.Button("Select the option from dropdown and then click here")
76
+
77
+
78
+ text_button.click(fn=get_correct_desc,inputs=in1,outputs=[out1, out2, out3])
79
+ text_button1.click(fn=get_correct_desc1,inputs=in2,outputs=[out4, out5, out6])
80
+
81
+ demo.launch()