Nikhil0987 commited on
Commit
3911b7f
1 Parent(s): 4a7c2fc
Files changed (1) hide show
  1. convo.py +27 -0
convo.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline, Conversation
2
+ import streamlit as st
3
+ from streamlit_option_menu import option_menu
4
+
5
+
6
+ def convo():
7
+ convo = st.text_input("Enter your message")
8
+ chatbot = pipeline(task= "conversational" ,model="microsoft/DialoGPT-medium")
9
+ # usrinput = Conversation(convo)
10
+ # chitchat = chatbot(usrinput)
11
+
12
+ ans = chatbot(
13
+ convo,candidate_labels=["HELP","PROBLEM SOLVE","GENERAL TALK"])
14
+ conversation.generated_responses[-1]
15
+
16
+ if ans["scores"][0] > 0.85:
17
+ st.session_state["user"] = "visitor"
18
+ with st.chat_message("assistant"):
19
+ "You are now sleeping in dream"
20
+ st.experimental_rerun()
21
+ else:
22
+ with st.chat_message("assistant"):
23
+ chitchat
24
+
25
+
26
+ convo()
27
+