Skip to content

Commit

Permalink
deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
jxnl committed Jul 26, 2023
1 parent a194448 commit 48f9cb3
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,4 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
examples/citation_with_extraction/fly.toml
14 changes: 14 additions & 0 deletions examples/citation_with_extraction/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# https://hub.docker.com/_/python
FROM python:3.10-slim-bullseye

ENV PYTHONUNBUFFERED True
ENV APP_HOME /app
WORKDIR $APP_HOME
COPY requirements.txt ./
RUN pip install -r requirements.txt


COPY . ./


CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8080"]
3 changes: 3 additions & 0 deletions examples/citation_with_extraction/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@

import os
import openai
import logging

logger = logging.getLogger(__name__)

# FastAPI app
app = FastAPI(
Expand Down Expand Up @@ -116,6 +118,7 @@ async def extract(question: Question, openai_key=Depends(get_api_key)):

async def generate():
for fact in facts:
logger.info(f"Fact: {fact}")
spans = list(fact.get_spans(question.context))
resp = {
"body": fact.body,
Expand Down
3 changes: 2 additions & 1 deletion examples/citation_with_extraction/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ fastapi
uvicorn
openai
pydantic
openai_function_call
openai_function_call
regex

0 comments on commit 48f9cb3

Please sign in to comment.