Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .dvc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/config.local
/tmp
/cache
6 changes: 6 additions & 0 deletions .dvc/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[core]
remote = myminio
['remote "myminio"']
url = s3://185.84.163.5:9000/dvcbucket2
access_key_id= yZ9qhDgPHuqaRpQZ4kgH
secret_access_key= IksmsR3BHMCJQO9R9hqH72n7kMRHTG7xAlsRlpZN
3 changes: 3 additions & 0 deletions .dvcignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Add patterns of files dvc should ignore, which could improve
# the performance. Learn more at
# https://dvc.org/doc/user-guide/dvcignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name: Python application

on:
push:
branches: [ "main" ]
branches: [ "dvc_deploy" ]
pull_request:
branches: [ "main" ]
branches: [ dvc_deploy" ]

permissions:
contents: read
Expand All @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
Expand All @@ -27,7 +27,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f src/requirements.txt ]; then pip install -r src/requirements.txt; fi
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
Expand All @@ -36,4 +36,4 @@ jobs:
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest src/test.py
pytest
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/test_data.csv
4 changes: 3 additions & 1 deletion active/fa.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
from fastapi import FastAPI
import model

app = FastAPI()
import model


def process(input_text):
return str(model.analyse(input_text)[0])


@app.get("/process_text/{text}")
async def process_text(text: str):
result = process(text)
Expand Down
3 changes: 1 addition & 2 deletions active/main.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@

import os
import uvicorn

if __name__ == "__main__":
try:
uvicorn.run("fa:app", host="0.0.0.0", port=int(os.environ['PORT']), reload=False, log_level="debug")
except Exception as e:
print("Error on running uvicorn: "+str(e))
print("Error on running uvicorn: "+str(e))
15 changes: 7 additions & 8 deletions active/model.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
from transformers import pipeline

clf = pipeline(
task = 'sentiment-analysis',
model = 'SkolkovoInstitute/russian_toxicity_classifier')
task='sentiment-analysis',
model='SkolkovoInstitute/russian_toxicity_classifier')

text = ['У нас в есть убунты и текникал превью.',
'Как минимум два малолетних дегенерата в треде, мда.',
'иди на хер']
text = ['У нас в есть убунты и текникал превью.', 'Как минимум два малолетних дегенерата в треде, мда.', 'иди на хер']


def analyse(text):
text=[text]
result=clf(text)
text = [text]
result = clf(text)
print(result)
return result

print(analyse("Кто любит жаб? Они крутые."))

print(analyse("Кто любит жаб? Они крутые."))
1 change: 1 addition & 0 deletions active/web_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
def process_text(input_text):
return str(model.analyse(input_text)[0])


# Обрабатываем введенный текст и выводим результат
if st.button('Показать результат'):
result = process_text(input_text)
Expand Down
2 changes: 0 additions & 2 deletions src/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@

import os
import uvicorn

if __name__ == "__main__":
Expand Down
5 changes: 5 additions & 0 deletions test_data.csv.dvc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
outs:
- md5: 7d9ee4c06927ceccef9dc27350e015c9
size: 52
hash: md5
path: test_data.csv