Spaces:
Sleeping
Sleeping
df
Browse files- babyagi/__init_.py +0 -0
- babyagi/classesa/__init_.py +0 -0
- babyagi/classesa/diamond.py +24 -1
- mysite/asgi.py +1 -1
- routers/diamond.py +22 -0
babyagi/__init_.py
ADDED
File without changes
|
babyagi/classesa/__init_.py
ADDED
File without changes
|
babyagi/classesa/diamond.py
CHANGED
@@ -1,5 +1,26 @@
|
|
1 |
import psycopg2
|
2 |
from sentence_transformers import SentenceTransformer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
class ProductDatabase:
|
5 |
def __init__(self, database_url):
|
@@ -76,7 +97,7 @@ def main():
|
|
76 |
query_text="1"
|
77 |
results = db.search_similar_all(query_text)
|
78 |
print("Search results:")
|
79 |
-
DEBUG=
|
80 |
if DEBUG==1:
|
81 |
for result in results:
|
82 |
print(result)
|
@@ -101,9 +122,11 @@ def main():
|
|
101 |
|
102 |
#query_text = "2.03-Very Good-J-SI2-62.2-58.0-7.27-7.33-4.55"
|
103 |
results = db.search_similar_vectors(query_text)
|
|
|
104 |
print("Search results:")
|
105 |
for result in results:
|
106 |
print(result)
|
|
|
107 |
|
108 |
finally:
|
109 |
# ζ₯ηΆγιγγ
|
|
|
1 |
import psycopg2
|
2 |
from sentence_transformers import SentenceTransformer
|
3 |
+
from fastapi import APIRouter, HTTPException
|
4 |
+
|
5 |
+
router = APIRouter()
|
6 |
+
|
7 |
+
@router.get("/route/{calat}/{wehth}/{state}/{x}")
|
8 |
+
async def route(calat: float, wehth: float, state: str, x: int):
|
9 |
+
# Validate input parameters
|
10 |
+
if not (0.0 <= calat <= 90.0):
|
11 |
+
raise HTTPException(status_code=400, detail="Invalid calat value.")
|
12 |
+
if not (0.0 <= wehth <= 180.0):
|
13 |
+
raise HTTPException(status_code=400, detail="Invalid wehth value.")
|
14 |
+
if state not in ["AC", "AL", "AP", ..., "TO"]:
|
15 |
+
raise HTTPException(status_code=400, detail="Invalid state value.")
|
16 |
+
if not (0 <= x <= 100):
|
17 |
+
raise HTTPException(status_code=400, detail="Invalid x value.")
|
18 |
+
|
19 |
+
# Process the request and return a response
|
20 |
+
# ...
|
21 |
+
|
22 |
+
return {"result": "OK"}
|
23 |
+
|
24 |
|
25 |
class ProductDatabase:
|
26 |
def __init__(self, database_url):
|
|
|
97 |
query_text="1"
|
98 |
results = db.search_similar_all(query_text)
|
99 |
print("Search results:")
|
100 |
+
DEBUG=0
|
101 |
if DEBUG==1:
|
102 |
for result in results:
|
103 |
print(result)
|
|
|
122 |
|
123 |
#query_text = "2.03-Very Good-J-SI2-62.2-58.0-7.27-7.33-4.55"
|
124 |
results = db.search_similar_vectors(query_text)
|
125 |
+
res_all = ""
|
126 |
print("Search results:")
|
127 |
for result in results:
|
128 |
print(result)
|
129 |
+
res_all += result+""
|
130 |
|
131 |
finally:
|
132 |
# ζ₯ηΆγιγγ
|
mysite/asgi.py
CHANGED
@@ -3,7 +3,7 @@ from django.core.asgi import get_asgi_application
|
|
3 |
from fastapi import FastAPI,Request
|
4 |
from fastapi.staticfiles import StaticFiles
|
5 |
from fastapi.templating import Jinja2Templates
|
6 |
-
|
7 |
from starlette.middleware.cors import CORSMiddleware
|
8 |
|
9 |
import gradio as gr
|
|
|
3 |
from fastapi import FastAPI,Request
|
4 |
from fastapi.staticfiles import StaticFiles
|
5 |
from fastapi.templating import Jinja2Templates
|
6 |
+
|
7 |
from starlette.middleware.cors import CORSMiddleware
|
8 |
|
9 |
import gradio as gr
|
routers/diamond.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# prompt: fastapi route ε¦ηδ½ζγεΌζ°γ―γcalat wehth state x
|
2 |
+
|
3 |
+
from fastapi import APIRouter, HTTPException
|
4 |
+
|
5 |
+
#router = APIRouter()
|
6 |
+
router = APIRouter(prefix="/leaning", tags=["leaning"])
|
7 |
+
@router.get("/route/{calat}/{wehth}/{state}/{x}")
|
8 |
+
async def route(calat: float, wehth: float, state: str, x: int):
|
9 |
+
# Validate input parameters
|
10 |
+
if not (0.0 <= calat <= 90.0):
|
11 |
+
raise HTTPException(status_code=400, detail="Invalid calat value.")
|
12 |
+
if not (0.0 <= wehth <= 180.0):
|
13 |
+
raise HTTPException(status_code=400, detail="Invalid wehth value.")
|
14 |
+
if state not in ["AC", "AL", "AP", ..., "TO"]:
|
15 |
+
raise HTTPException(status_code=400, detail="Invalid state value.")
|
16 |
+
if not (0 <= x <= 100):
|
17 |
+
raise HTTPException(status_code=400, detail="Invalid x value.")
|
18 |
+
|
19 |
+
# Process the request and return a response
|
20 |
+
# ...
|
21 |
+
|
22 |
+
return {"result": "OK"}
|