aibmedia commited on
Commit
ada8eae
·
verified ·
1 Parent(s): b107c2a

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +6 -3
main.py CHANGED
@@ -45,11 +45,14 @@ def server_one():
45
 
46
  @app.route('/findsimilarity')
47
  def server_1():
48
-
49
- response = os.system(" curl https://api-inference.huggingface.co/models/sentence-transformers/all-MiniLM-L6-v2 -X POST -d '{ "inputs": { "source_sentence": "That is a happy person", "sentences": [ "That is a happy dog", "That is a very happy person", "Today is a sunny day" , ] } , } ' -H 'Content-Type: application/json' -H 'Authorization: `+bearer+`' " )
50
  time.sleep(3)
 
 
 
51
 
52
- return str(response)
53
  # @app.route('/chat', methods=['POST'])
54
  # def chat():
55
  # try:
 
45
 
46
  @app.route('/findsimilarity')
47
  def server_1():
48
+ payload = { "inputs": { "source_sentence": "That is a happy person", "sentences": [ "That is a happy dog", "That is a very happy person", "Today is a sunny day" ] }, }
49
+ response = requests.post(API_URL, headers=headers, json=payload)
50
  time.sleep(3)
51
+ return response.json()
52
+
53
+ # response = os.system(" curl https://api-inference.huggingface.co/models/sentence-transformers/all-MiniLM-L6-v2 -X POST -d '{ "inputs": { "source_sentence": "That is a happy person", "sentences": [ "That is a happy dog", "That is a very happy person", "Today is a sunny day" , ] } , } ' -H 'Content-Type: application/json' -H 'Authorization: `+bearer+`' " )
54
 
55
+
56
  # @app.route('/chat', methods=['POST'])
57
  # def chat():
58
  # try: