Subbu1304 commited on
Commit
be5399f
·
verified ·
1 Parent(s): bf23068

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py CHANGED
@@ -12,6 +12,8 @@ from flask.sessions import SecureCookieSessionInterface # Import the class
12
  from salesforce import get_salesforce_connection
13
  import os
14
 
 
 
15
  # Initialize Flask app and Salesforce connection
16
  print("Starting app...")
17
  app = Flask(__name__)
@@ -44,6 +46,18 @@ app = Flask(__name__)
44
  device = "cuda" if torch.cuda.is_available() else "cpu"
45
  asr_model = pipeline("automatic-speech-recognition", model="openai/whisper-small", device=0 if device == "cuda" else -1)
46
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  # Function to generate audio prompts
48
  def generate_audio_prompt(text, filename):
49
  tts = gTTS(text=text, lang="en")
 
12
  from salesforce import get_salesforce_connection
13
  import os
14
 
15
+
16
+
17
  # Initialize Flask app and Salesforce connection
18
  print("Starting app...")
19
  app = Flask(__name__)
 
46
  device = "cuda" if torch.cuda.is_available() else "cpu"
47
  asr_model = pipeline("automatic-speech-recognition", model="openai/whisper-small", device=0 if device == "cuda" else -1)
48
 
49
+ def query_salesforce_data(sf):
50
+ # Example of querying a customer record
51
+ try:
52
+ # Query the Customer_Login__c object
53
+ customers = sf.query("SELECT Id, Name FROM Customer_Login__c LIMIT 5")
54
+
55
+ # Loop through the records returned by the query
56
+ for customer in customers['records']:
57
+ print(customer['Id'], customer['Name'])
58
+ except Exception as e:
59
+ print(f"Error querying Salesforce: {e}")
60
+
61
  # Function to generate audio prompts
62
  def generate_audio_prompt(text, filename):
63
  tts = gTTS(text=text, lang="en")