deeksonparlma commited on
Commit
b608be2
·
1 Parent(s): 3cae971
Files changed (1) hide show
  1. app.py +10 -66
app.py CHANGED
@@ -52,81 +52,25 @@ def chat(message, history):
52
  results_index = np.argmax(results)
53
  tag = labels[results_index]
54
 
55
- for tg in data["intents"]:
56
- if tg['tag'] == tag:
57
- responses = tg['responses']
 
58
 
59
- # print(random.choice(responses))
60
- response = random.choice(responses)
61
 
62
- history.append((message, response))
63
- return history, history
64
 
65
  chatbot = gr.Chatbot(label="Chat")
66
- css = """
67
- footer {display:none !important}
68
- .output-markdown{display:none !important}
69
- .gr-button-primary {
70
- z-index: 14;
71
- height: 43px;
72
- width: 130px;
73
- left: 0px;
74
- top: 0px;
75
- padding: 0px;
76
- cursor: pointer !important;
77
- background: none rgb(17, 20, 45) !important;
78
- border: none !important;
79
- text-align: center !important;
80
- font-family: Poppins !important;
81
- font-size: 14px !important;
82
- font-weight: 500 !important;
83
- color: rgb(255, 255, 255) !important;
84
- line-height: 1 !important;
85
- border-radius: 12px !important;
86
- transition: box-shadow 200ms ease 0s, background 200ms ease 0s !important;
87
- box-shadow: none !important;
88
- }
89
- .gr-button-primary:hover{
90
- z-index: 14;
91
- height: 43px;
92
- width: 130px;
93
- left: 0px;
94
- top: 0px;
95
- padding: 0px;
96
- cursor: pointer !important;
97
- background: none rgb(37, 56, 133) !important;
98
- border: none !important;
99
- text-align: center !important;
100
- font-family: Poppins !important;
101
- font-size: 14px !important;
102
- font-weight: 500 !important;
103
- color: rgb(255, 255, 255) !important;
104
- line-height: 1 !important;
105
- border-radius: 12px !important;
106
- transition: box-shadow 200ms ease 0s, background 200ms ease 0s !important;
107
- box-shadow: rgb(0 0 0 / 23%) 0px 1px 7px 0px !important;
108
- }
109
- .hover\:bg-orange-50:hover {
110
- --tw-bg-opacity: 1 !important;
111
- background-color: rgb(229,225,255) !important;
112
- }
113
-
114
- div[data-testid="user"] {
115
- background-color: #253885 !important;
116
- }
117
-
118
- .h-\[40vh\]{
119
- height: 70vh !important;
120
- }
121
-
122
- """
123
  demo = gr.Interface(
124
  chat,
125
  [gr.Textbox(lines=1, label="Message"), "state"],
126
  [chatbot, "state"],
127
  allow_flagging="never",
128
- title="Mental Health Bot | Data Science Dojo",
129
- css=css
130
  )
131
  if __name__ == "__main__":
132
  demo.launch()
 
52
  results_index = np.argmax(results)
53
  tag = labels[results_index]
54
 
55
+ return tag
56
+ # for tg in data["intents"]:
57
+ # if tg['tag'] == tag:
58
+ # responses = tg['responses']
59
 
60
+ # # print(random.choice(responses))
61
+ # response = random.choice(responses)
62
 
63
+ # history.append((message, response))
64
+ # return history, history
65
 
66
  chatbot = gr.Chatbot(label="Chat")
67
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  demo = gr.Interface(
69
  chat,
70
  [gr.Textbox(lines=1, label="Message"), "state"],
71
  [chatbot, "state"],
72
  allow_flagging="never",
73
+ title="Tabibu | Mental Health Bot",
 
74
  )
75
  if __name__ == "__main__":
76
  demo.launch()