Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -4,25 +4,12 @@ from transformers import pipeline
|
|
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="
|
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
|
15 |
-
# string parameter called text. The function generates text based on the # input using the pipeline() object, and returns a JSON response
|
16 |
-
# containing the generated text under the key "output"
|
17 |
@app.get("/generate")
|
18 |
-
def generate(
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
"""
|
24 |
-
# Use the pipeline to generate text from the given input text
|
25 |
-
output = pipe(text)
|
26 |
-
|
27 |
-
# Return the generated text in a JSON response
|
28 |
-
return {"output": output[0]["generated_text"]}
|
|
|
4 |
# Create a new FastAPI app instance
|
5 |
app = FastAPI()
|
6 |
|
|
|
|
|
|
|
7 |
pipe = pipeline("text2text-generation",
|
8 |
+
model="mat27/medmnistPrueba")
|
9 |
+
|
|
|
|
|
|
|
|
|
10 |
@app.get("/generate")
|
11 |
+
def generate(imagen: np.array):
|
12 |
+
|
13 |
+
output = pipe(imagen)
|
14 |
+
|
15 |
+
return {"Precisión: ": output}
|
|
|
|
|
|
|
|
|
|
|
|