Skip to content

Commit

Permalink
Merge pull request #14 from Sibbear1980/branch_kate
Browse files Browse the repository at this point in the history
Update files (PEP8)
  • Loading branch information
KateProxa authored Mar 13, 2024
2 parents 57eca2c + 0f91600 commit cc1e3a4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 4 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
app = FastAPI()
tokenizer = BertTokenizerFast.from_pretrained(
"blanchefort/rubert-base-cased-sentiment"
)
)
model = AutoModelForSequenceClassification.from_pretrained(
"blanchefort/rubert-base-cased-sentiment", return_dict=True
)
Expand All @@ -17,7 +17,7 @@
@app.get("/")
def root() -> dict:
"""
This function works from root
This function works from root
and demonstrates welcome message.
Returns:
Expand All @@ -30,13 +30,12 @@ def root() -> dict:
# функция для расчета модели,
# в "input" передаются текст
def predict(input: dict) -> dict:

"""
This function predicts
This function predicts
Args:
input (dict): dict with text for prediction
Returns:
dict: dict with the prediction of text sentiment
"""
Expand Down
4 changes: 3 additions & 1 deletion test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ def test_predict_russian_negative():

# тест 6
def test_predict_russian_neutral():
response = client.post("/predict/", json={"text": "Сегодня наступила весна"})
response = client.post("/predict/",
json={"text": "Сегодня наступила весна"}
)
json_data = response.json()
assert response.status_code == 200
assert json_data["Результат:"] == "нейтральный"
Expand Down

0 comments on commit cc1e3a4

Please sign in to comment.