Skip to content

mbilab/which-media-are-you

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

equirement

  • python >= 3.6.9

Setup

Create your own virtual environment, then install all the required packages.

virtualenv -p python3 'venv name'
source 'venv name'/bin/activate
pip3 install -r requirements.txt
yarn

Make symbolic links for the big folders, which are not in main directory.

ln -s /home/tintin/predictor/model
ln -s /home/tintin/predictor/pickle

Command-line usage

Specify text and segmentation_type. Call predict() to get the probabilities of media.

Example:

  1. Create test.py and write the following code.
from predict import pov.py

text = [text to be predicted]
segmentation_type = [segmentation type] #  'jieba' or 'ckiptagger'
print(predict(text, segmentation_type))
  1. Run test.py and you will see an output like
[0.11421281 0.12740344 0.10493702 0.10435487 0.12456657 0.11950728 0.111482 0.10811266 0.08542336]

The output represents the probabilities of [民視 中國時報 公視 中央通訊社 自由時報 PChome Nownews 三立 Ettoday].

Web usage

  1. Run frontend ./app/index.pug and fastapi predictor.py concurrently with the following command line. You need to replace the ports with yours.
frontend_port=[frontend_port] fastapi_port=[fastapi_port] npm run web
  1. Open the website on [host]:[frontend port] with your browser.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Vue 60.5%
  • Python 35.8%
  • Pug 2.3%
  • JavaScript 1.4%