eagle0504 commited on
Commit
380acef
1 Parent(s): 4b2f61b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -12
app.py CHANGED
@@ -61,22 +61,21 @@ def call_chatgpt(prompt: str) -> str:
61
 
62
  def ai_judge(sentence1: str, sentence2: str) -> float:
63
 
64
- HF_TOKEN = os.environ["HF_TOKEN"]
65
- API_URL = "https://api-inference.huggingface.co/models/sentence-transformers/msmarco-distilbert-base-tas-b"
66
- headers = {"Authorization": f"Bearer {HF_TOKEN}"}
67
-
 
 
68
  def helper(payload):
69
  response = requests.post(API_URL, headers=headers, json=payload)
70
  return response.json()
71
 
72
- data = helper(
73
- {
74
- "inputs": {
75
- "source_sentence": sentence1,
76
- "sentences": [sentence2]
77
- }
78
- }
79
- )
80
 
81
  return data
82
 
 
61
 
62
  def ai_judge(sentence1: str, sentence2: str) -> float:
63
 
64
+ API_URL = "https://laazu6ral9w37pfb.us-east-1.aws.endpoints.huggingface.cloud"
65
+ headers = {
66
+ "Accept" : "application/json",
67
+ "Content-Type": "application/json"
68
+ }
69
+
70
  def helper(payload):
71
  response = requests.post(API_URL, headers=headers, json=payload)
72
  return response.json()
73
 
74
+ data = helper({
75
+ "source_sentence": sentence1,
76
+ "sentences": [sentence2],
77
+ "parameters": {}
78
+ })
 
 
 
79
 
80
  return data
81