ahmad-alismail commited on
Commit
8557156
·
verified ·
1 Parent(s): 223de65

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -2,13 +2,15 @@ from fastapi import FastAPI
2
  from transformers import pipeline
3
 
4
  # Create a new FastAPI app instance
5
- app = FastAPI()
 
 
6
 
7
  # Initialize the text generation pipeline
8
  # This function will be able to generate text
9
  # given an input.
10
- pipe = pipeline("text2text-generation",
11
- model="google/flan-t5-small")
12
 
13
  # Define a function to handle the GET request at `/generate`
14
  # The generate() function is defined as a FastAPI route that takes a
 
2
  from transformers import pipeline
3
 
4
  # Create a new FastAPI app instance
5
+ # NOTE - we configure docs_url to serve the interactive Docs at the root path
6
+ # of the app. This way, we can use the docs as a landing page for the app on Spaces.
7
+ app = FastAPI(docs_url="/")
8
 
9
  # Initialize the text generation pipeline
10
  # This function will be able to generate text
11
  # given an input.
12
+ pipe = pipeline("text2text-generation", model="google/flan-t5-small")
13
+
14
 
15
  # Define a function to handle the GET request at `/generate`
16
  # The generate() function is defined as a FastAPI route that takes a