-
Notifications
You must be signed in to change notification settings - Fork 0
/
InteractionWithCaller.py
56 lines (45 loc) · 1.4 KB
/
InteractionWithCaller.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import AudioToText
import TextToAudio
import API_1
from info import Caller
import CheckMissingData
import pandas as pd
## Call is received
def Check(info):
if info.caller_name == "XXX":
return "What is your name?"
elif info.incident_location == "XXX":
return "Where are you?"
elif info.incident_type == "XXX":
return "What is the emergency?"
elif info.symptoms == "XXX":
return "What are the symptoms?"
else:
return None
keep_talking = 1
cur_caller = Caller()
# initial prompt
say = "9 1 1, what's your emergency?"
while keep_talking == 1:
TextToAudio.translate(say)
# receive audio input
#input = AudioToText.translate()
input1 = input("Enter response: ")
print(input1)
# send to AI Text Processing
classification = API_1.get_completion(input1, cur_caller)
print(classification)
# actually dont need classification here, it is needed for backend stuff
#
# Determine if we need more information
say = Check(classification)
if say == None:
keep_talking = 0
filename = 'new_hacks_2023.json'
df = pd.read_json(filename)
name_list = df['first_name']
if classification.caller_name in name_list:
index = (list(name_list)).index(classification.caller_name)
df_information = df.iloc[index]
print(df_information)
print(classification)