Spaces:
Runtime error
Runtime error
refactor(app): update acess tokens
Browse files
app.py
CHANGED
@@ -1,13 +1,15 @@
|
|
1 |
from fastapi import FastAPI
|
2 |
from transformers import pipeline
|
|
|
3 |
# Create a new FastAPI app instance
|
4 |
app = FastAPI()
|
5 |
|
6 |
# Initialize the text generation pipeline
|
7 |
# This function will be able to generate text
|
8 |
# given an input.
|
|
|
9 |
pipe = pipeline("text2text-generation",
|
10 |
-
model="Quizzer/Context2Question")
|
11 |
|
12 |
# Define a function to handle the GET request at `/generate`
|
13 |
# The generate() function is defined as a FastAPI route that takes a
|
|
|
1 |
from fastapi import FastAPI
|
2 |
from transformers import pipeline
|
3 |
+
import os
|
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 |
+
auth_token = os.environ.get("AUTH_TOKEN")
|
11 |
pipe = pipeline("text2text-generation",
|
12 |
+
model="Quizzer/Context2Question",use_auth_token=auth_token)
|
13 |
|
14 |
# Define a function to handle the GET request at `/generate`
|
15 |
# The generate() function is defined as a FastAPI route that takes a
|