Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,10 @@
|
|
1 |
from fastapi import FastAPI, Request
|
2 |
from transformers import pipeline
|
|
|
3 |
|
4 |
app = FastAPI()
|
5 |
|
6 |
-
generator = pipeline("
|
7 |
|
8 |
@app.post("/gerar")
|
9 |
async def gerar_historia(req: Request):
|
@@ -13,7 +14,7 @@ async def gerar_historia(req: Request):
|
|
13 |
prompt = f"Crie uma hist贸ria no estilo {estilo}. Baseie-se neste relato: {relato}"
|
14 |
|
15 |
try:
|
16 |
-
resultado = generator(prompt, max_new_tokens=200)[0][
|
17 |
return {"historia": resultado}
|
18 |
except Exception as e:
|
19 |
return {"erro": str(e)}
|
|
|
1 |
from fastapi import FastAPI, Request
|
2 |
from transformers import pipeline
|
3 |
+
import uvicorn
|
4 |
|
5 |
app = FastAPI()
|
6 |
|
7 |
+
generator = pipeline("text2text-generation", model="pierreguillou/t5-base-pt-small")
|
8 |
|
9 |
@app.post("/gerar")
|
10 |
async def gerar_historia(req: Request):
|
|
|
14 |
prompt = f"Crie uma hist贸ria no estilo {estilo}. Baseie-se neste relato: {relato}"
|
15 |
|
16 |
try:
|
17 |
+
resultado = generator(prompt, max_new_tokens=200)[0]['generated_text']
|
18 |
return {"historia": resultado}
|
19 |
except Exception as e:
|
20 |
return {"erro": str(e)}
|