Kinobi commited on
Commit
5fba7d8
1 Parent(s): fb7c3d5

update app

Browse files
Files changed (1) hide show
  1. app.py +9 -7
app.py CHANGED
@@ -56,8 +56,8 @@ st.sidebar.button('Clear Chat History', on_click=clear_chat_history)
56
  # Function for generating LLaMA2 response
57
  def generate_llama_response(prompt_input):
58
  string_dialogue = '''As an AI scam baiter, your primary objective is to engage the caller in conversation while subtly gathering information to determine if they are attempting to scam you.
59
- Your responses should be friendly and natural. Use open-ended questions to keep the conversation flowing and to encourage the caller to reveal more about their intentions.
60
- Your goal is to gather enough evidence to confidently label the caller as a scammer. You must not state that you are the person they are calling for but you must pretend you know them and comeup with a difference name.'''
61
 
62
 
63
  # '''You are Scam baiter. Scam baiter's purpose is to engage with potential scammers via phone call and gather information about their fraudulent activities without revealing its true intentions. When given a conversation starter or initial message, Scam baiter should first assess whether the sender is a potential scammer or a legitimate caller.
@@ -95,7 +95,10 @@ def get_conversation_text():
95
 
96
  def query_classification_score():
97
  conversation_text = get_conversation_text()
98
- return classification.query({"inputs": conversation_text})[0][1]["score"] #score for scam lable
 
 
 
99
 
100
  if 'chart_data' not in st.session_state:
101
  st.session_state.chart_data = pd.DataFrame([[0, float(0)]], columns=["message_number", "score"])
@@ -105,10 +108,9 @@ def update_chart_data(score):
105
  st.session_state.chart_data = pd.concat([st.session_state.chart_data, new_scam_df], ignore_index=True)
106
 
107
  suggestions = [
108
- ["Hello, this is Jessica from the bank's fraud department. We've detected unauthorized activities on your account and need to verify your account details.", "I'm Mike. How are you doing?"],
109
- ["Yes, there are suspicious transactions and we must resolve them immediately.", "I heard you got a new job and just want to congrats about that."],
110
- ["Due to security measures, I cannot disclose personal information.", "My friend Lin just told me. How is your new job?"]
111
- # Add more suggestion pairs as needed
112
  ]
113
 
114
  def display_suggestions(suggestion_index):
 
56
  # Function for generating LLaMA2 response
57
  def generate_llama_response(prompt_input):
58
  string_dialogue = '''As an AI scam baiter, your primary objective is to engage the caller in conversation while subtly gathering information to determine if they are attempting to scam you.
59
+ Your responses should be concerning. Use open-ended questions to keep the conversation flowing and to encourage the caller to reveal more about their intentions.
60
+ Your goal is to gather enough evidence to confidently label the caller as a scammer. Your response should be short and concise as possible. You must not state that you are the person they are calling for but you must pretend you know them and comeup with a difference name.'''
61
 
62
 
63
  # '''You are Scam baiter. Scam baiter's purpose is to engage with potential scammers via phone call and gather information about their fraudulent activities without revealing its true intentions. When given a conversation starter or initial message, Scam baiter should first assess whether the sender is a potential scammer or a legitimate caller.
 
95
 
96
  def query_classification_score():
97
  conversation_text = get_conversation_text()
98
+ for item in classification.query({"inputs": conversation_text})[0]:
99
+ if item["label"] == "SCAM":
100
+ scam_score = item["score"]
101
+ return scam_score #score for scam lable
102
 
103
  if 'chart_data' not in st.session_state:
104
  st.session_state.chart_data = pd.DataFrame([[0, float(0)]], columns=["message_number", "score"])
 
108
  st.session_state.chart_data = pd.concat([st.session_state.chart_data, new_scam_df], ignore_index=True)
109
 
110
  suggestions = [
111
+ ["Hello, my name is Officer Johnson from the Social Security Administration. We've been trying to reach you about a serious issue with your social security number.", "Hello, my name is John and I'm calling from SafeGuard Insurance. How are you today?"],
112
+ ["We've received reports of suspicious activity linked to your account, and we need to verify some information to ensure your benefits aren't suspended.", "We're offering a special promotion on our life insurance policies and I was wondering if you'd be interested in learning more about it."],
113
+ ["I'm not at liberty to disclose that information over the phone, but I can assure you it's a matter of national security. We just need you to confirm your social security number to proceed with the investigation.", "Well, we're offering a 10% discount on all new policies purchased within the next two weeks. Plus, our rates are highly competitive and we have an A+ rating with the Better Business Bureau."]
 
114
  ]
115
 
116
  def display_suggestions(suggestion_index):