jsvs commited on
Commit
06ee306
·
2 Parent(s): 46f60b3 777ab15

Merge branch 'main' of hf.co:spaces/Quizzer/Context2Question

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -2,6 +2,7 @@ from fastapi import FastAPI
2
  from fastapi.middleware.cors import CORSMiddleware
3
 
4
  from transformers import pipeline
 
5
  # Create a new FastAPI app instance
6
  app = FastAPI()
7
  origins = ["*"]
@@ -15,8 +16,9 @@ app.add_middleware(
15
  # Initialize the text generation pipeline
16
  # This function will be able to generate text
17
  # given an input.
 
18
  pipe = pipeline("text2text-generation",
19
- model="visoc/Text2Question",use_auth_token=True)
20
 
21
  # Define a function to handle the GET request at `/generate`
22
  # The generate() function is defined as a FastAPI route that takes a
 
2
  from fastapi.middleware.cors import CORSMiddleware
3
 
4
  from transformers import pipeline
5
+ import os
6
  # Create a new FastAPI app instance
7
  app = FastAPI()
8
  origins = ["*"]
 
16
  # Initialize the text generation pipeline
17
  # This function will be able to generate text
18
  # given an input.
19
+ auth_token = os.environ.get("AUTH_TOKEN")
20
  pipe = pipeline("text2text-generation",
21
+ model="Quizzer/Context2Question",use_auth_token=auth_token)
22
 
23
  # Define a function to handle the GET request at `/generate`
24
  # The generate() function is defined as a FastAPI route that takes a