efeno commited on
Commit
3205fa5
1 Parent(s): 3ccedc0
Files changed (3) hide show
  1. api/main.py +1 -2
  2. test.py +24 -0
  3. vercel.json +15 -0
api/main.py CHANGED
@@ -51,8 +51,7 @@ async def find_similar_code_and_explain(code_request: UserCodeRequest):
51
  print("=" * 50)
52
 
53
  answer = activeloop_service.query_engine.query(intro_question)
54
- print(f"Answer: {answer}\n")
55
-
56
  return {
57
  "answer": answer,
58
  }
 
51
  print("=" * 50)
52
 
53
  answer = activeloop_service.query_engine.query(intro_question)
54
+ print(f"Answer: {answer.__dict__}\n")
 
55
  return {
56
  "answer": answer,
57
  }
test.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import textwrap
2
+ from fastapi import FastAPI
3
+ from pydantic import BaseModel
4
+ from dotenv import load_dotenv
5
+
6
+ from api.external_services import InitiazlizeGithubService, InitiazlizeActiveloopService
7
+
8
+ # Load environment variables
9
+ load_dotenv()
10
+
11
+ github_service = InitiazlizeGithubService()
12
+ activeloop_service = InitiazlizeActiveloopService()
13
+
14
+ # upload
15
+ repo_url = "https://github.com/facebookresearch/segment-anything"
16
+ owner, repo = github_service.parse_github_url(repo_url)
17
+ docs = github_service.load_repo_data(owner, repo)
18
+ activeloop_service.upload_to_activeloop(docs)
19
+
20
+
21
+ # retrieve
22
+ intro_question = "what this code is talking about?"
23
+ answer = activeloop_service.query_engine.query(intro_question)
24
+ print(answer.__dict__)
vercel.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "version": 2,
3
+ "builds": [
4
+ {
5
+ "src": "api/main.py",
6
+ "use": "@vercel/python"
7
+ }
8
+ ],
9
+ "routes": [
10
+ {
11
+ "src": "/(.*)",
12
+ "dest": "api/main.py"
13
+ }
14
+ ]
15
+ }