Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -6,20 +6,4 @@ os.environ['TRANSFORMERS_CACHE'] = '/blabla/cache/'
|
|
6 |
# Create a new FastAPI app instance
|
7 |
app = FastAPI()
|
8 |
|
9 |
-
|
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 |
-
# Define a function to handle the GET request at `/generate`
|
15 |
-
# The generate() function is defined as a FastAPI route that takes a
|
16 |
-
# string parameter called text. The function generates text based on the # input using the pipeline() object, and returns a JSON response
|
17 |
-
# containing the generated text under the key "output"
|
18 |
-
@app.get("/generate")
|
19 |
-
def generate(text: str):
|
20 |
-
|
21 |
-
# Use the pipeline to generate text from the given input text
|
22 |
-
output = pipe(text)
|
23 |
-
|
24 |
-
# Return the generated text in a JSON response
|
25 |
-
return {"output": output[0]["generated_text"]}
|
|
|
6 |
# Create a new FastAPI app instance
|
7 |
app = FastAPI()
|
8 |
|
9 |
+
pipe = pipeline(model="mat27/medmnistPrueba")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|