Skip to content

Commit

Permalink
Merge pull request #1 from tharuka-pavith/dev
Browse files Browse the repository at this point in the history
Upgrade to v0.1.0
  • Loading branch information
th4ruka authored May 4, 2024
2 parents 26e5c3c + 59a2dff commit 5ffaa6d
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
__pycache__
.env
/bot-env
4 changes: 4 additions & 0 deletions .gcloudignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
__pycache__
.env
/secrets/
/bot-env/
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM python:3.10-slim

ENV PYTHONUNBUFFERED True

# ENV APP_HOME ./app
# WORKDIR $APP_HOME
COPY . ./

ENV PORT 8080

# Expose port
EXPOSE ${PORT}

RUN pip install --no-cache-dir -r requirements.txt

# As an example here we're running the web service with one worker on uvicorn.
CMD exec uvicorn main:app --host 0.0.0.0 --port ${PORT} --workers 1
1 change: 1 addition & 0 deletions firebase/firebase_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from dotenv import load_dotenv
load_dotenv()

#Replace with real values when deploying
SERVICE_ACCOUNT_KEY = {
"type": os.environ["TYPE"],
"project_id": os.environ["PROJECT_ID"],
Expand Down
24 changes: 22 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,30 @@
from handlers.chat_handler import chat_agent_response
from dotenv import load_dotenv
load_dotenv()
app = FastAPI()

description = """
GAN Based Text to Image Synthesizer API
### Description
@app.post("/chat-bot")
Generate images according to text descriptions.
"""
tags_metadata = [
{
"name": "chat-bot",
"description": "Endpoint to chat with the bot",
},
]

app = FastAPI(
title="Text-to-Image Bot API (dev)",
description=description,
version="0.1.0",
openapi_tags=tags_metadata
)


@app.post("/chat-bot", description="Endpoint to chat with the bot",tags=["chat-bot"])
def chat_endpoint(chat: HumanMessageModel) -> AIMessageModel:
response = chat_agent_response(chat)
return response
Expand Down
Binary file modified requirements.txt
Binary file not shown.

0 comments on commit 5ffaa6d

Please sign in to comment.