deeksonparlma commited on
Commit ·
b608be2
1
Parent(s): 3cae971
updates
Browse files51 unmodified lines52535455555657565758595960606162626363646566666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121136711411511611711811912012112268697071721281297374757651 unmodified lines results_index = np.argmax(results) tag = labels[results_index]
return tag for tg in data["intents"]: if tg['tag'] == tag: responses = tg['responses'] # for tg in data["intents"]: # if tg['tag'] == tag: # responses = tg['responses']
# print(random.choice(responses)) response = random.choice(responses) # # print(random.choice(responses)) # response = random.choice(responses) history.append((message, response)) return history, history # history.append((message, response)) # return history, history
chatbot = gr.Chatbot(label="Chat")css = """footer {display:none !important}.output-markdown{display:none !important}.gr-button-primary { z-index: 14; height: 43px; width: 130px; left: 0px; top: 0px; padding: 0px; cursor: pointer !important; background: none rgb(17, 20, 45) !important; border: none !important; text-align: center !important; font-family: Poppins !important; font-size: 14px !important; font-weight: 500 !important; color: rgb(255, 255, 255) !important; line-height: 1 !important; border-radius: 12px !important; transition: box-shadow 200ms ease 0s, background 200ms ease 0s !important; box-shadow: none !important;}.gr-button-primary:hover{ z-index: 14; height: 43px; width: 130px; left: 0px; top: 0px; padding: 0px; cursor: pointer !important; background: none rgb(37, 56, 133) !important; border: none !important; text-align: center !important; font-family: Poppins !important; font-size: 14px !important; font-weight: 500 !important; color: rgb(255, 255, 255) !important; line-height: 1 !important; border-radius: 12px !important; transition: box-shadow 200ms ease 0s, background 200ms ease 0s !important; box-shadow: rgb(0 0 0 / 23%) 0px 1px 7px 0px !important;}.hover\:bg-orange-50:hover { --tw-bg-opacity: 1 !important; background-color: rgb(229,225,255) !important;}
div[data-testid="user"] { background-color: #253885 !important;}
.h-\[40vh\]{height: 70vh !important;}
"""demo = gr.Interface( chat, [gr.Textbox(lines=1, label="Message"), "state"], [chatbot, "state"], allow_flagging="never", title="Mental Health Bot | Data Science Dojo", css=css title="Tabibu | Mental Health Bot",)if __name__ == "__main__": demo.launch()app.py+10-66