Spaces:
Runtime error
Runtime error
shravya commited on
Commit ·
3fc3c48
1
Parent(s): cb12976
endpoints
Browse files- api.py +13 -0
- endpoints.py +35 -0
- test.py +3 -3
api.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
|
| 3 |
+
def main():
|
| 4 |
+
st.title("Growthy API Documentation")
|
| 5 |
+
|
| 6 |
+
st.markdown("## Swagger UI")
|
| 7 |
+
st.markdown('<iframe src="http://127.0.0.1:8000/documentation" width="100%" height="600px"></iframe>', unsafe_allow_html=True)
|
| 8 |
+
|
| 9 |
+
st.markdown("## ReDoc")
|
| 10 |
+
st.markdown('<iframe src="http://127.0.0.1:8000/redoc" width="100%" height="1000px"></iframe>', unsafe_allow_html=True)
|
| 11 |
+
|
| 12 |
+
if __name__ == '__main__':
|
| 13 |
+
main()
|
endpoints.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import uvicorn
|
| 2 |
+
from fastapi import FastAPI, Query
|
| 3 |
+
from crew import til
|
| 4 |
+
|
| 5 |
+
description = """
|
| 6 |
+
API helps you do awesome stuff. 🚀
|
| 7 |
+
|
| 8 |
+
"""
|
| 9 |
+
|
| 10 |
+
tags_metadata = [
|
| 11 |
+
{
|
| 12 |
+
"name": "feedback",
|
| 13 |
+
"description": "Gives the feedback about the content",
|
| 14 |
+
},
|
| 15 |
+
]
|
| 16 |
+
|
| 17 |
+
app = FastAPI(
|
| 18 |
+
title="Growthy API",
|
| 19 |
+
description=description,
|
| 20 |
+
summary="Deadpool's favorite app. Nuff said.",
|
| 21 |
+
version="0.0.1",
|
| 22 |
+
openapi_tags=tags_metadata,
|
| 23 |
+
docs_url="/documentation",
|
| 24 |
+
)
|
| 25 |
+
|
| 26 |
+
@app.get("/feedback", tags=["feedback"])
|
| 27 |
+
async def test_kickoff(content: str = Query(...)):
|
| 28 |
+
inputs = {"content": content}
|
| 29 |
+
result = til.TilCrew().kickoff(inputs)
|
| 30 |
+
return result
|
| 31 |
+
|
| 32 |
+
if __name__ == "__main__":
|
| 33 |
+
uvicorn.run(app, host="127.0.0.1", port=8000)
|
| 34 |
+
|
| 35 |
+
|
test.py
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
|
|
| 1 |
from dotenv import load_dotenv
|
| 2 |
-
load_dotenv()
|
| 3 |
-
|
| 4 |
from crew.til import TilCrew
|
| 5 |
-
import streamlit as st
|
| 6 |
from streamlit_extras.capture import stdout
|
|
|
|
|
|
|
| 7 |
|
| 8 |
|
| 9 |
def main():
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
from dotenv import load_dotenv
|
|
|
|
|
|
|
| 3 |
from crew.til import TilCrew
|
|
|
|
| 4 |
from streamlit_extras.capture import stdout
|
| 5 |
+
load_dotenv()
|
| 6 |
+
|
| 7 |
|
| 8 |
|
| 9 |
def main():
|