RathodHarish commited on
Commit
45a579f
·
verified ·
1 Parent(s): d2ad93f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -14,7 +14,10 @@ SF_SECURITY_TOKEN = os.getenv("SF_SECURITY_TOKEN", "jq4VVHUFti6TmzJDjjegv2h6b")
14
  SF_INSTANCE_URL = os.getenv("SF_INSTANCE_URL", "https://voicebot-dev-ed.my.salesforce.com") # Verify correct API URL
15
 
16
  # Hugging Face Inference API token (store in environment variables)
17
- HF_TOKEN = os.getenv("HF_TOKEN") # No default; must be set in Space secrets
 
 
 
18
 
19
  # Initialize Salesforce connection
20
  try:
@@ -46,7 +49,8 @@ def transcribe_audio(audio_file):
46
  if not HF_TOKEN:
47
  error_msg = (
48
  "Error transcribing audio: HF_TOKEN not set. Please set HF_TOKEN in Space secrets at "
49
- "https://huggingface.co/spaces/your-username/HealthVoiceAnalyzer/settings."
 
50
  )
51
  print(error_msg)
52
  return error_msg
@@ -82,7 +86,8 @@ def analyze_symptoms(text):
82
  if not HF_TOKEN:
83
  error_msg = (
84
  "Error analyzing symptoms: HF_TOKEN not set. Please set HF_TOKEN in Space secrets at "
85
- "https://huggingface.co/spaces/your-username/HealthVoiceAnalyzer/settings."
 
86
  )
87
  print(error_msg)
88
  return error_msg, 0.0
 
14
  SF_INSTANCE_URL = os.getenv("SF_INSTANCE_URL", "https://voicebot-dev-ed.my.salesforce.com") # Verify correct API URL
15
 
16
  # Hugging Face Inference API token (store in environment variables)
17
+ HF_TOKEN = os.getenv("HF_TOKEN") # Must be set in Space secrets
18
+
19
+ # Log HF_TOKEN status at startup
20
+ print(f"HF_TOKEN status: {'Set' if HF_TOKEN else 'Not set'}")
21
 
22
  # Initialize Salesforce connection
23
  try:
 
49
  if not HF_TOKEN:
50
  error_msg = (
51
  "Error transcribing audio: HF_TOKEN not set. Please set HF_TOKEN in Space secrets at "
52
+ "https://huggingface.co/spaces/your-username/HealthVoiceAnalyzer/settings. "
53
+ "Generate a token with Inference API access at https://huggingface.co/settings/tokens."
54
  )
55
  print(error_msg)
56
  return error_msg
 
86
  if not HF_TOKEN:
87
  error_msg = (
88
  "Error analyzing symptoms: HF_TOKEN not set. Please set HF_TOKEN in Space secrets at "
89
+ "https://huggingface.co/spaces/your-username/HealthVoiceAnalyzer/settings. "
90
+ "Generate a token with Inference API access at https://huggingface.co/settings/tokens."
91
  )
92
  print(error_msg)
93
  return error_msg, 0.0