Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -2,6 +2,7 @@ import os
|
|
| 2 |
from flask import Flask, render_template
|
| 3 |
import threading
|
| 4 |
import asyncio
|
|
|
|
| 5 |
|
| 6 |
from openai import OpenAI
|
| 7 |
|
|
@@ -38,7 +39,17 @@ def server_one():
|
|
| 38 |
s1 = "Results"
|
| 39 |
|
| 40 |
return render_template("similarity_1.html", sourcetxt = sourcesim, s1 = s1 , headertxt = bearer )
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
# @app.route('/chat', methods=['POST'])
|
| 43 |
# def chat():
|
| 44 |
# try:
|
|
|
|
| 2 |
from flask import Flask, render_template
|
| 3 |
import threading
|
| 4 |
import asyncio
|
| 5 |
+
import time
|
| 6 |
|
| 7 |
from openai import OpenAI
|
| 8 |
|
|
|
|
| 39 |
s1 = "Results"
|
| 40 |
|
| 41 |
return render_template("similarity_1.html", sourcetxt = sourcesim, s1 = s1 , headertxt = bearer )
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
|
| 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:
|