GitPT-Activeloop / test.py
efeno's picture
new files
3205fa5
raw
history blame
716 Bytes
import textwrap
from fastapi import FastAPI
from pydantic import BaseModel
from dotenv import load_dotenv
from api.external_services import InitiazlizeGithubService, InitiazlizeActiveloopService
# Load environment variables
load_dotenv()
github_service = InitiazlizeGithubService()
activeloop_service = InitiazlizeActiveloopService()
# upload
repo_url = "https://github.com/facebookresearch/segment-anything"
owner, repo = github_service.parse_github_url(repo_url)
docs = github_service.load_repo_data(owner, repo)
activeloop_service.upload_to_activeloop(docs)
# retrieve
intro_question = "what this code is talking about?"
answer = activeloop_service.query_engine.query(intro_question)
print(answer.__dict__)