Spaces:
Sleeping
Sleeping
sarthaksavvy
commited on
Commit
·
1011f56
1
Parent(s):
6f92752
[main] move to root
Browse files- fastapi/Dockerfile → Dockerfile +0 -0
- fastapi/app.py → app.py +5 -4
- compose.yml +0 -17
fastapi/Dockerfile → Dockerfile
RENAMED
|
File without changes
|
fastapi/app.py → app.py
RENAMED
|
@@ -1,15 +1,16 @@
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
-
|
| 3 |
from transformers import pipeline
|
| 4 |
|
| 5 |
app = FastAPI()
|
| 6 |
|
|
|
|
| 7 |
@app.get('/')
|
| 8 |
def home():
|
| 9 |
-
return {"hello":"world"}
|
|
|
|
| 10 |
|
| 11 |
@app.get('/ask')
|
| 12 |
-
def ask(prompt:str):
|
| 13 |
pipe = pipeline("text2text-generation", model="google/flan-t5-base")
|
| 14 |
output = pipe(prompt)
|
| 15 |
-
return output[0]['generated_text']
|
|
|
|
| 1 |
from fastapi import FastAPI
|
|
|
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
app = FastAPI()
|
| 5 |
|
| 6 |
+
|
| 7 |
@app.get('/')
|
| 8 |
def home():
|
| 9 |
+
return {"hello": "world"}
|
| 10 |
+
|
| 11 |
|
| 12 |
@app.get('/ask')
|
| 13 |
+
def ask(prompt: str):
|
| 14 |
pipe = pipeline("text2text-generation", model="google/flan-t5-base")
|
| 15 |
output = pipe(prompt)
|
| 16 |
+
return output[0]['generated_text']
|
compose.yml
DELETED
|
@@ -1,17 +0,0 @@
|
|
| 1 |
-
version: "3"
|
| 2 |
-
|
| 3 |
-
services:
|
| 4 |
-
web:
|
| 5 |
-
build: fastapi
|
| 6 |
-
ports:
|
| 7 |
-
- 8000:8000
|
| 8 |
-
networks:
|
| 9 |
-
- tutorial-net
|
| 10 |
-
volumes:
|
| 11 |
-
- ./fastapi:/app
|
| 12 |
-
networks:
|
| 13 |
-
tutorial-net:
|
| 14 |
-
driver: bridge
|
| 15 |
-
# volumes:
|
| 16 |
-
# tutorial-vol:
|
| 17 |
-
# driver:loc
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|