From 0f6b3305c202ada5d2ab7b79f95aa4f58fd00679 Mon Sep 17 00:00:00 2001 From: priyanshij12 <129949880+priyanshij12@users.noreply.github.com> Date: Sun, 11 Jun 2023 21:50:01 +0530 Subject: [PATCH] Create main.py --- main.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 main.py diff --git a/main.py b/main.py new file mode 100644 index 00000000..610b5fc1 --- /dev/null +++ b/main.py @@ -0,0 +1,15 @@ +from fastapi import FastAPI, HTTPException +import requests + +app = FastAPI() + +@ app.post("/process-prompt") +async def process_prompt(prompt: str): + bark_url = "https://api.github.com/repos/username/Bark" + headers = {"Accept": "application/vnd.github.v3+json"} + + response = requests.post(bark_url, headers=headers, json={"prompt": prompt}) + if response.status_code == 200: + return response.json() + else: + raise HTTPException(status_code=500, detail="Failed to process prompt")