Spaces:
Runtime error
Runtime error
macrdel
commited on
Commit
•
3164527
1
Parent(s):
ad71124
add handle of pipeline summarization
Browse files- app/api.py +9 -1
app/api.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
import config.config as config
|
2 |
-
from app.src.src import pipeline_sentiment, pipeline_stats
|
3 |
|
4 |
from fastapi import FastAPI
|
5 |
from pydantic import BaseModel
|
@@ -9,6 +9,8 @@ import pandas as pd
|
|
9 |
import os
|
10 |
|
11 |
sentiment_model = pipeline(model=config.sentiment_model)
|
|
|
|
|
12 |
app = FastAPI()
|
13 |
|
14 |
class YouTubeUrl(BaseModel):
|
@@ -30,6 +32,12 @@ def get_stats_sent():
|
|
30 |
data = pd.read_csv(f"{config.DATA_FILE}")
|
31 |
return pipeline_stats(data)
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
if __name__ == '__main__':
|
35 |
uvicorn.run(app, host='127.0.0.1', port=80)
|
|
|
1 |
import config.config as config
|
2 |
+
from app.src.src import pipeline_sentiment, pipeline_stats, pipeline_summarize
|
3 |
|
4 |
from fastapi import FastAPI
|
5 |
from pydantic import BaseModel
|
|
|
9 |
import os
|
10 |
|
11 |
sentiment_model = pipeline(model=config.sentiment_model)
|
12 |
+
sum_model = pipeline(model=config.sum_model, use_fast=True)
|
13 |
+
|
14 |
app = FastAPI()
|
15 |
|
16 |
class YouTubeUrl(BaseModel):
|
|
|
32 |
data = pd.read_csv(f"{config.DATA_FILE}")
|
33 |
return pipeline_stats(data)
|
34 |
|
35 |
+
@app.get('/summarization')
|
36 |
+
def get_summarize():
|
37 |
+
if f"{config.NAME_DATA}" in os.listdir(f"{config.PATH_DATA}"):
|
38 |
+
data = pd.read_csv(f"{config.DATA_FILE}")
|
39 |
+
return pipeline_summarize(data['text_comment'], sum_model)
|
40 |
+
|
41 |
|
42 |
if __name__ == '__main__':
|
43 |
uvicorn.run(app, host='127.0.0.1', port=80)
|