MarioPrzBasto commited on
Commit
72ac86a
·
1 Parent(s): f88e527

Add application file

Browse files
Files changed (3) hide show
  1. Dockerfile +1 -1
  2. app.py +10 -0
  3. requirements.txt +7 -2
Dockerfile CHANGED
@@ -6,5 +6,5 @@ WORKDIR /
6
 
7
  RUN pip install --no-cache-dir --upgrade -r /requirements.txt
8
 
9
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
10
 
 
6
 
7
  RUN pip install --no-cache-dir --upgrade -r /requirements.txt
8
 
9
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
10
 
app.py CHANGED
@@ -1,7 +1,17 @@
1
  from fastapi import FastAPI
 
 
2
 
3
  app = FastAPI()
4
 
 
 
 
 
 
 
 
 
5
  @app.get("/", tags=["Home"])
6
  def api_home():
7
  return {'detail': 'Welcome to FastAPI TextGen Tutorial!'}
 
1
  from fastapi import FastAPI
2
+ from fastapi.middleware.cors import CORSMiddleware
3
+
4
 
5
  app = FastAPI()
6
 
7
+ app.add_middleware(
8
+ CORSMiddleware,
9
+ allow_origins=["*"],
10
+ allow_credentials=True,
11
+ allow_methods=["*"],
12
+ allow_headers=["*"],
13
+ )
14
+
15
  @app.get("/", tags=["Home"])
16
  def api_home():
17
  return {'detail': 'Welcome to FastAPI TextGen Tutorial!'}
requirements.txt CHANGED
@@ -1,2 +1,7 @@
1
- fastapi
2
- uvicorn
 
 
 
 
 
 
1
+ fastapi==0.99.1
2
+ uvicorn
3
+ requests
4
+ pydantic==1.10.12
5
+ langchain
6
+ clarifai
7
+ Pillow