SudhanshuBlaze commited on
Commit
49cae18
1 Parent(s): b1a7b97

fix options parameter for for payload query

Browse files
Files changed (1) hide show
  1. EDxHuggingface.py +2 -1
EDxHuggingface.py CHANGED
@@ -10,6 +10,7 @@ load_dotenv()
10
  # AI model code
11
  HF_API_KEY = os.getenv("HF_API_KEY")
12
 
 
13
  API_URL_ED = "https://api-inference.huggingface.co/models/bhadresh-savani/bert-base-go-emotion"
14
  API_URL_HS = "https://api-inference.huggingface.co/models/IMSyPP/hate_speech_en"
15
  headers = {"Authorization": f"Bearer {HF_API_KEY}"}
@@ -107,7 +108,7 @@ with st.sidebar:
107
  if submit:
108
 
109
  # Call API and get predicted probabilities for each emotion category and hate speech classification
110
- payload = {"inputs": text_input, "use_cache": True, "wait_for_model": True}
111
  response_ED, response_HS = query(payload)
112
  predicted_probabilities_ED = response_ED[0]
113
  predicted_probabilities_HS = response_HS[0]
 
10
  # AI model code
11
  HF_API_KEY = os.getenv("HF_API_KEY")
12
 
13
+ # API_URL_ED = "https://api-inference.huggingface.co/models/j-hartmann/emotion-english-distilroberta-base" #alternate ED model(slow loading on first run)
14
  API_URL_ED = "https://api-inference.huggingface.co/models/bhadresh-savani/bert-base-go-emotion"
15
  API_URL_HS = "https://api-inference.huggingface.co/models/IMSyPP/hate_speech_en"
16
  headers = {"Authorization": f"Bearer {HF_API_KEY}"}
 
108
  if submit:
109
 
110
  # Call API and get predicted probabilities for each emotion category and hate speech classification
111
+ payload = {"inputs": text_input, "options": {"wait_for_model": True, "use_cache": True}}
112
  response_ED, response_HS = query(payload)
113
  predicted_probabilities_ED = response_ED[0]
114
  predicted_probabilities_HS = response_HS[0]