Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -21,7 +21,7 @@ headers = {"Authorization": bearer }
|
|
21 |
|
22 |
app = Flask(__name__)
|
23 |
|
24 |
-
@app.route('/
|
25 |
def command_app():
|
26 |
res = tool.run("Obama's first name?")
|
27 |
|
@@ -36,7 +36,7 @@ def command_app():
|
|
36 |
response = requests.post(API_URL, headers=headers, json=payload)
|
37 |
return response.json() + res
|
38 |
|
39 |
-
@app.route('/')
|
40 |
def command_server():
|
41 |
|
42 |
print("command run")
|
@@ -44,56 +44,3 @@ def command_server():
|
|
44 |
|
45 |
|
46 |
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
# import requests
|
51 |
-
|
52 |
-
# app = FastAPI()
|
53 |
-
|
54 |
-
# @app.get("/infer_t5")
|
55 |
-
# def t5(input):
|
56 |
-
# return {"output": "-"}
|
57 |
-
|
58 |
-
|
59 |
-
# @app.get("/")
|
60 |
-
# def index():
|
61 |
-
|
62 |
-
# # List of sentences to be processed
|
63 |
-
# sentences = [
|
64 |
-
# "Poor beggar of the trans gender community begs for instant coffee",
|
65 |
-
# "The fish dreamed of escaping the fishbowl and into the toilet where he saw his friend go.",
|
66 |
-
# "The person box was packed with jelly many dozens of months later.",
|
67 |
-
# "Gay drinks both instant coffee and energy drink"
|
68 |
-
# ]
|
69 |
-
|
70 |
-
# # Initializing the Sentence Transformer model using BERT with mean-tokens pooling
|
71 |
-
# model = SentenceTransformer('bert-base-nli-mean-tokens')
|
72 |
-
|
73 |
-
# # Encoding the sentences to obtain their embeddings
|
74 |
-
# sentence_embeddings = model.encode(sentences)
|
75 |
-
|
76 |
-
# # Calculating the cosine similarity between the first sentence embedding and the rest of the embeddings
|
77 |
-
# # The result will be a list of similarity scores between the first sentence and each of the other sentences
|
78 |
-
# similarity_scores = cosine_similarity([sentence_embeddings[0]], sentence_embeddings[1:])
|
79 |
-
# return similarity_scores
|
80 |
-
|
81 |
-
# import requests
|
82 |
-
|
83 |
-
# API_URL = "https://api-inference.huggingface.co/models/sentence-transformers/all-MiniLM-L6-v2"
|
84 |
-
# headers = {"Authorization": "Bearer hf_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}
|
85 |
-
|
86 |
-
# def query(payload):
|
87 |
-
# response = requests.post(API_URL, headers=headers, json=payload)
|
88 |
-
# return response.json()
|
89 |
-
|
90 |
-
# output = query({
|
91 |
-
# "inputs": {
|
92 |
-
# "source_sentence": "That is a happy person",
|
93 |
-
# "sentences": [
|
94 |
-
# "That is a happy dog",
|
95 |
-
# "That is a very happy person",
|
96 |
-
# "Today is a sunny day"
|
97 |
-
# ]
|
98 |
-
# },
|
99 |
-
# })
|
|
|
21 |
|
22 |
app = Flask(__name__)
|
23 |
|
24 |
+
@app.route('/')
|
25 |
def command_app():
|
26 |
res = tool.run("Obama's first name?")
|
27 |
|
|
|
36 |
response = requests.post(API_URL, headers=headers, json=payload)
|
37 |
return response.json() + res
|
38 |
|
39 |
+
@app.route('/app')
|
40 |
def command_server():
|
41 |
|
42 |
print("command run")
|
|
|
44 |
|
45 |
|
46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|