tjtanaa commited on
Commit
be79e0d
·
1 Parent(s): df15484

update main

Browse files
Files changed (1) hide show
  1. main.py +7 -6
main.py CHANGED
@@ -1,19 +1,20 @@
1
  from fastapi import FastAPI
2
  from fastapi.staticfiles import StaticFiles
3
  from fastapi.responses import FileResponse
 
4
  from transformers import pipeline
5
 
6
  app = FastAPI()
7
 
8
- app.mount("/", StaticFiles(directory="static", html=True), name="static")
9
-
10
- @app.get("/")
11
- def index() -> FileResponse:
12
- return FileResponse(path="/app/static/index.html", media_type="text/html")
13
-
14
  pipe_flan = pipeline("text2text-generation", model="google/flan-t5-small")
15
 
16
  @app.get("/infer_t5")
17
  def t5(input):
18
  output = pipe_flan(input)
19
  return {"output": output[0]["generated_text"]}
 
 
 
 
 
 
 
1
  from fastapi import FastAPI
2
  from fastapi.staticfiles import StaticFiles
3
  from fastapi.responses import FileResponse
4
+
5
  from transformers import pipeline
6
 
7
  app = FastAPI()
8
 
 
 
 
 
 
 
9
  pipe_flan = pipeline("text2text-generation", model="google/flan-t5-small")
10
 
11
  @app.get("/infer_t5")
12
  def t5(input):
13
  output = pipe_flan(input)
14
  return {"output": output[0]["generated_text"]}
15
+
16
+ app.mount("/", StaticFiles(directory="static", html=True), name="static")
17
+
18
+ @app.get("/")
19
+ def index() -> FileResponse:
20
+ return FileResponse(path="/app/static/index.html", media_type="text/html")