Spaces:
Sleeping
Sleeping
load env
Browse files
app.py
CHANGED
@@ -12,6 +12,10 @@ import time
|
|
12 |
import torch
|
13 |
import traceback
|
14 |
import logging
|
|
|
|
|
|
|
|
|
15 |
|
16 |
# Import local modules
|
17 |
from classifiers import TFIDFClassifier, LLMClassifier
|
|
|
12 |
import torch
|
13 |
import traceback
|
14 |
import logging
|
15 |
+
from dotenv import load_dotenv
|
16 |
+
|
17 |
+
# Load environment variables from .env file
|
18 |
+
load_dotenv()
|
19 |
|
20 |
# Import local modules
|
21 |
from classifiers import TFIDFClassifier, LLMClassifier
|
utils.py
CHANGED
@@ -174,38 +174,3 @@ def validate_results(df, text_columns, client):
|
|
174 |
|
175 |
except Exception as e:
|
176 |
return f"Validation failed: {str(e)}"
|
177 |
-
|
178 |
-
|
179 |
-
def create_example_file():
|
180 |
-
"""
|
181 |
-
Create an example CSV file for testing
|
182 |
-
|
183 |
-
Returns:
|
184 |
-
str: Path to the created file
|
185 |
-
"""
|
186 |
-
# Create some example data
|
187 |
-
data = {
|
188 |
-
"text": [
|
189 |
-
"I absolutely love this product! It exceeded all my expectations.",
|
190 |
-
"The service was terrible and the staff was rude.",
|
191 |
-
"The product arrived on time but was slightly damaged.",
|
192 |
-
"I have mixed feelings about this. Some features are great, others not so much.",
|
193 |
-
"This is a complete waste of money. Do not buy!",
|
194 |
-
"The customer service team was very helpful in resolving my issue.",
|
195 |
-
"It's okay, nothing special but gets the job done.",
|
196 |
-
"I'm extremely disappointed with the quality of this product.",
|
197 |
-
"This is the best purchase I've made all year!",
|
198 |
-
"It's reasonably priced and works as expected.",
|
199 |
-
]
|
200 |
-
}
|
201 |
-
|
202 |
-
# Create dataframe
|
203 |
-
df = pd.DataFrame(data)
|
204 |
-
|
205 |
-
# Save to a CSV file
|
206 |
-
example_dir = "examples"
|
207 |
-
os.makedirs(example_dir, exist_ok=True)
|
208 |
-
file_path = os.path.join(example_dir, "sample_reviews.csv")
|
209 |
-
df.to_csv(file_path, index=False)
|
210 |
-
|
211 |
-
return file_path
|
|
|
174 |
|
175 |
except Exception as e:
|
176 |
return f"Validation failed: {str(e)}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|