Spaces:
Runtime error
Runtime error
uvicorn debug
Browse files- src/api.py +2 -2
- src/inference.py +3 -4
src/api.py
CHANGED
|
@@ -47,5 +47,5 @@ async def prediction(request: Request, text: str = Form(None)):
|
|
| 47 |
|
| 48 |
|
| 49 |
# lancer le serveur et le recharger a chaque modification sauvegardee
|
| 50 |
-
if __name__ == "__main__":
|
| 51 |
-
|
|
|
|
| 47 |
|
| 48 |
|
| 49 |
# lancer le serveur et le recharger a chaque modification sauvegardee
|
| 50 |
+
# if __name__ == "__main__":
|
| 51 |
+
# uvicorn.run("api:app", port=8000, reload=True)
|
src/inference.py
CHANGED
|
@@ -7,7 +7,6 @@ import torch
|
|
| 7 |
|
| 8 |
import dataloader
|
| 9 |
from model import Decoder, Encoder, EncoderDecoderModel
|
| 10 |
-
from transformers import AutoModel
|
| 11 |
|
| 12 |
with open("model/vocab.pkl", "rb") as vocab:
|
| 13 |
words = pickle.load(vocab)
|
|
@@ -52,6 +51,6 @@ def inferenceAPI(text: str) -> str:
|
|
| 52 |
return vectoriser.decode(output)
|
| 53 |
|
| 54 |
|
| 55 |
-
if __name__ == "__main__":
|
| 56 |
-
|
| 57 |
-
|
|
|
|
| 7 |
|
| 8 |
import dataloader
|
| 9 |
from model import Decoder, Encoder, EncoderDecoderModel
|
|
|
|
| 10 |
|
| 11 |
with open("model/vocab.pkl", "rb") as vocab:
|
| 12 |
words = pickle.load(vocab)
|
|
|
|
| 51 |
return vectoriser.decode(output)
|
| 52 |
|
| 53 |
|
| 54 |
+
# if __name__ == "__main__":
|
| 55 |
+
# # inference()
|
| 56 |
+
# print(inferenceAPI("If you choose to use these attributes in logged messages, you need to exercise some care. In the above example, for instance, the Formatter has been set up with a format string which expects ‘clientip’ and ‘user’ in the attribute dictionary of the LogRecord. If these are missing, the message will not be logged because a string formatting exception will occur. So in this case, you always need to pass the extra dictionary with these keys."))
|