Spaces:
Building
Building
Update run.py
Browse files
run.py
CHANGED
@@ -10,11 +10,12 @@ import uuid
|
|
10 |
|
11 |
|
12 |
class Config:
|
13 |
-
UPLOAD_FOLDER = os.path.join(os.path.dirname(__file__), 'uploads')
|
14 |
MAX_CONTENT_LENGTH = 16 * 1024 * 1024 # 16MB max file size
|
15 |
CORS_HEADERS = 'Content-Type'
|
16 |
|
17 |
|
|
|
18 |
class DialogueSentimentAnalyzer:
|
19 |
def __init__(self, model_name: str = "microsoft/DialogRPT-updown"):
|
20 |
self.device = 0 if torch.cuda.is_available() else -1
|
@@ -136,7 +137,7 @@ def create_app():
|
|
136 |
return jsonify({'error': 'No transcript received'}), 400
|
137 |
|
138 |
# Save the transcript in the current folder
|
139 |
-
file_path = os.path.join(
|
140 |
with open(file_path, 'w') as file:
|
141 |
file.write(transcript)
|
142 |
|
|
|
10 |
|
11 |
|
12 |
class Config:
|
13 |
+
UPLOAD_FOLDER = os.path.join(os.path.dirname(__file__), 'uploads') # Correct path
|
14 |
MAX_CONTENT_LENGTH = 16 * 1024 * 1024 # 16MB max file size
|
15 |
CORS_HEADERS = 'Content-Type'
|
16 |
|
17 |
|
18 |
+
|
19 |
class DialogueSentimentAnalyzer:
|
20 |
def __init__(self, model_name: str = "microsoft/DialogRPT-updown"):
|
21 |
self.device = 0 if torch.cuda.is_available() else -1
|
|
|
137 |
return jsonify({'error': 'No transcript received'}), 400
|
138 |
|
139 |
# Save the transcript in the current folder
|
140 |
+
file_path = os.path.join(app.config['UPLOAD_FOLDER'], 'transcript.txt')
|
141 |
with open(file_path, 'w') as file:
|
142 |
file.write(transcript)
|
143 |
|