Spaces:
Sleeping
Sleeping
LorenzoBioinfo commited on
Commit ·
1a42889
1
Parent(s): f521a9c
Testapp
Browse files- src/app.py +7 -2
- tests/integration/test_app.py +3 -0
src/app.py
CHANGED
|
@@ -26,14 +26,19 @@ labels = ["negative", "neutral", "positive"]
|
|
| 26 |
# TWEET EVAL
|
| 27 |
if not os.path.exists(TWEET_PROCESSED_PATH):
|
| 28 |
print(f"Dataset Tweet Eval non trovato in {TWEET_PROCESSED_PATH}. Lo genero...")
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
| 30 |
tweet_eval = load_from_disk(TWEET_PROCESSED_PATH)
|
| 31 |
|
| 32 |
|
| 33 |
# YOUTUBE COMMENTS
|
| 34 |
if not os.path.exists(YT_PROCESSED_PATH):
|
| 35 |
print(f" Dataset YouTube non trovato in {YT_PROCESSED_PATH}. Lo genero...")
|
| 36 |
-
|
|
|
|
|
|
|
| 37 |
youtube_ds = load_from_disk(YT_PROCESSED_PATH)
|
| 38 |
|
| 39 |
app = FastAPI(
|
|
|
|
| 26 |
# TWEET EVAL
|
| 27 |
if not os.path.exists(TWEET_PROCESSED_PATH):
|
| 28 |
print(f"Dataset Tweet Eval non trovato in {TWEET_PROCESSED_PATH}. Lo genero...")
|
| 29 |
+
|
| 30 |
+
if not os.environ.get("SKIP_DATA_PREP"):
|
| 31 |
+
if not os.path.exists(TWEET_PROCESSED_PATH):
|
| 32 |
+
subprocess.run(["python", "src/data_preparation.py", "tweet_eval"], check=True)
|
| 33 |
tweet_eval = load_from_disk(TWEET_PROCESSED_PATH)
|
| 34 |
|
| 35 |
|
| 36 |
# YOUTUBE COMMENTS
|
| 37 |
if not os.path.exists(YT_PROCESSED_PATH):
|
| 38 |
print(f" Dataset YouTube non trovato in {YT_PROCESSED_PATH}. Lo genero...")
|
| 39 |
+
if not os.environ.get("SKIP_DATA_PREP"):
|
| 40 |
+
if not os.path.exists(YT_PROCESSED_PATH):
|
| 41 |
+
subprocess.run(["python", "src/data_preparation.py", "youtube"], check=True)
|
| 42 |
youtube_ds = load_from_disk(YT_PROCESSED_PATH)
|
| 43 |
|
| 44 |
app = FastAPI(
|
tests/integration/test_app.py
CHANGED
|
@@ -1,6 +1,9 @@
|
|
| 1 |
import pytest
|
| 2 |
from fastapi.testclient import TestClient
|
| 3 |
from src.app import app
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
client = TestClient(app)
|
| 6 |
|
|
|
|
| 1 |
import pytest
|
| 2 |
from fastapi.testclient import TestClient
|
| 3 |
from src.app import app
|
| 4 |
+
import os
|
| 5 |
+
|
| 6 |
+
os.environ["SKIP_DATA_PREP"] = "true"
|
| 7 |
|
| 8 |
client = TestClient(app)
|
| 9 |
|