Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -13,15 +13,67 @@ print(headers)
|
|
13 |
app = Flask(__name__)
|
14 |
|
15 |
|
16 |
-
@app.route('/')
|
17 |
def server_home():
|
18 |
-
|
|
|
|
|
19 |
|
20 |
-
form = {'model': 'mxbai-embed-large', 'prompt': 'Give the cosine similarity for each 1.Its a rainy day. 2. The news says it will rain 3. The cat pass across the street'}
|
21 |
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
|
27 |
# import asyncio
|
@@ -42,3 +94,4 @@ def server_home():
|
|
42 |
|
43 |
if __name__=='__main__':
|
44 |
app.run(debug=True)
|
|
|
|
13 |
app = Flask(__name__)
|
14 |
|
15 |
|
16 |
+
@app.route('/app')
|
17 |
def server_home():
|
18 |
+
|
19 |
+
|
20 |
+
return str(headers)
|
21 |
|
|
|
22 |
|
23 |
+
# import asyncio
|
24 |
+
|
25 |
+
# async def nested():
|
26 |
+
# return 42
|
27 |
+
|
28 |
+
# async def main():
|
29 |
+
# # Nothing happens if we just call "nested()".
|
30 |
+
# # A coroutine object is created but not awaited,
|
31 |
+
# # so it *won't run at all*.
|
32 |
+
# nested() # will raise a "RuntimeWarning".
|
33 |
|
34 |
+
# # Let's do it differently now and await it:
|
35 |
+
# print(await nested()) # will print "42".
|
36 |
+
|
37 |
+
# asyncio.run(main())
|
38 |
+
|
39 |
+
if __name__=='__main__':
|
40 |
+
app.run(debug=True)
|
41 |
+
|
42 |
+
|
43 |
+
|
44 |
+
|
45 |
+
|
46 |
+
# import requests
|
47 |
+
# import os
|
48 |
+
# import asyncio
|
49 |
+
|
50 |
+
# # from langchain_core.tools import Tool
|
51 |
+
# # from langchain_google_community import GoogleSearchAPIWrapper
|
52 |
+
|
53 |
+
# from flask import Flask
|
54 |
+
|
55 |
+
|
56 |
+
# API_URL = "https://api-inference.huggingface.co/models/sentence-transformers/all-MiniLM-L6-v2"
|
57 |
+
# bearer = "Bearer " + os.getenv('TOKEN')
|
58 |
+
# headers = {"Authorization": bearer }
|
59 |
+
# print("headers")
|
60 |
+
# print(headers)
|
61 |
+
|
62 |
+
# app = Flask(__name__)
|
63 |
+
|
64 |
+
|
65 |
+
# async def command_similarity():
|
66 |
+
# 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"]},}
|
67 |
+
# return str( requests.post(API_URL, headers=headers, json=payload) )
|
68 |
+
|
69 |
+
# async def asynm1():
|
70 |
+
# return await command_similarity()
|
71 |
+
|
72 |
+
# @app.route('/app')
|
73 |
+
# def server_home():
|
74 |
+
# asyncio.run(asynm1())
|
75 |
+
# print("command run")
|
76 |
+
# return asyncio.run(asynm1())
|
77 |
|
78 |
|
79 |
# import asyncio
|
|
|
94 |
|
95 |
if __name__=='__main__':
|
96 |
app.run(debug=True)
|
97 |
+
|