Spaces:
Runtime error
Runtime error
Merge pull request #12 from EveSa/EveBis
Browse filesfix(function): fix name function and their calls
- src/api.py +4 -4
- src/inference_lstm.py +1 -1
- src/inference_t5.py +1 -1
src/api.py
CHANGED
|
@@ -2,17 +2,17 @@ from fastapi import FastAPI, Form, Request
|
|
| 2 |
from fastapi.staticfiles import StaticFiles
|
| 3 |
from fastapi.templating import Jinja2Templates
|
| 4 |
|
| 5 |
-
from src.inference_lstm import
|
| 6 |
-
from src.inference_t5 import
|
| 7 |
|
| 8 |
|
| 9 |
# ------ INFERENCE MODEL --------------------------------------------------------------
|
| 10 |
# appel de la fonction inference, adaptee pour une entree txt
|
| 11 |
def summarize(text: str):
|
| 12 |
if choisir_modele.var == "lstm":
|
| 13 |
-
return " ".join(
|
| 14 |
elif choisir_modele.var == "fineTunedT5":
|
| 15 |
-
text =
|
| 16 |
|
| 17 |
|
| 18 |
# ----------------------------------------------------------------------------------
|
|
|
|
| 2 |
from fastapi.staticfiles import StaticFiles
|
| 3 |
from fastapi.templating import Jinja2Templates
|
| 4 |
|
| 5 |
+
from src.inference_lstm import inference_lstm
|
| 6 |
+
from src.inference_t5 import inference_t5
|
| 7 |
|
| 8 |
|
| 9 |
# ------ INFERENCE MODEL --------------------------------------------------------------
|
| 10 |
# appel de la fonction inference, adaptee pour une entree txt
|
| 11 |
def summarize(text: str):
|
| 12 |
if choisir_modele.var == "lstm":
|
| 13 |
+
return " ".join(inference_lstm(text))
|
| 14 |
elif choisir_modele.var == "fineTunedT5":
|
| 15 |
+
text = inference_t5(text)
|
| 16 |
|
| 17 |
|
| 18 |
# ----------------------------------------------------------------------------------
|
src/inference_lstm.py
CHANGED
|
@@ -15,7 +15,7 @@ with open("model/vocab.pkl", "rb") as vocab:
|
|
| 15 |
vectoriser = dataloader.Vectoriser(words)
|
| 16 |
|
| 17 |
|
| 18 |
-
def
|
| 19 |
"""
|
| 20 |
Predict the summary for an input text
|
| 21 |
--------
|
|
|
|
| 15 |
vectoriser = dataloader.Vectoriser(words)
|
| 16 |
|
| 17 |
|
| 18 |
+
def inference_lstm(text: str) -> str:
|
| 19 |
"""
|
| 20 |
Predict the summary for an input text
|
| 21 |
--------
|
src/inference_t5.py
CHANGED
|
@@ -17,7 +17,7 @@ def clean_text(texts: str) -> str:
|
|
| 17 |
return texts
|
| 18 |
|
| 19 |
|
| 20 |
-
def
|
| 21 |
"""
|
| 22 |
Predict the summary for an input text
|
| 23 |
--------
|
|
|
|
| 17 |
return texts
|
| 18 |
|
| 19 |
|
| 20 |
+
def inference_t5(text: str) -> str:
|
| 21 |
"""
|
| 22 |
Predict the summary for an input text
|
| 23 |
--------
|