Spaces:
Running
Running
Upload models.py with huggingface_hub
Browse files
models.py
CHANGED
|
@@ -79,6 +79,7 @@ class Vote(db.Model):
|
|
| 79 |
# Sentence origin tracking
|
| 80 |
sentence_hash = db.Column(db.String(64), nullable=True, index=True) # SHA-256 hash of the sentence
|
| 81 |
sentence_origin = db.Column(db.String(20), nullable=True) # 'dataset', 'custom', 'unknown'
|
|
|
|
| 82 |
counts_for_public_leaderboard = db.Column(db.Boolean, default=True) # Whether this vote counts for public leaderboard
|
| 83 |
|
| 84 |
chosen = db.relationship(
|
|
@@ -233,9 +234,10 @@ def anonymize_ip_address(ip_address):
|
|
| 233 |
return None
|
| 234 |
|
| 235 |
|
| 236 |
-
def record_vote(user_id, text, chosen_model_id, rejected_model_id, model_type,
|
| 237 |
-
session_duration=None, ip_address=None, user_agent=None,
|
| 238 |
-
generation_date=None, cache_hit=None, all_dataset_sentences=None
|
|
|
|
| 239 |
"""Record a vote and update Elo ratings."""
|
| 240 |
|
| 241 |
# Determine sentence origin and whether it should count for public leaderboard
|
|
@@ -266,6 +268,7 @@ def record_vote(user_id, text, chosen_model_id, rejected_model_id, model_type,
|
|
| 266 |
cache_hit=cache_hit,
|
| 267 |
sentence_hash=sentence_hash,
|
| 268 |
sentence_origin=sentence_origin,
|
|
|
|
| 269 |
counts_for_public_leaderboard=counts_for_public,
|
| 270 |
)
|
| 271 |
db.session.add(vote)
|
|
@@ -634,7 +637,7 @@ def insert_initial_models():
|
|
| 634 |
is_active=True,
|
| 635 |
model_url="https://inworld.ai/tts",
|
| 636 |
voice="Ashley",
|
| 637 |
-
api_model_id="inworld-tts-1
|
| 638 |
),
|
| 639 |
Model(
|
| 640 |
id="inworld-max",
|
|
|
|
| 79 |
# Sentence origin tracking
|
| 80 |
sentence_hash = db.Column(db.String(64), nullable=True, index=True) # SHA-256 hash of the sentence
|
| 81 |
sentence_origin = db.Column(db.String(20), nullable=True) # 'dataset', 'custom', 'unknown'
|
| 82 |
+
sentence_category = db.Column(db.String(50), nullable=True) # 'service', 'podcast', 'diacritics', 'user-generated', etc.
|
| 83 |
counts_for_public_leaderboard = db.Column(db.Boolean, default=True) # Whether this vote counts for public leaderboard
|
| 84 |
|
| 85 |
chosen = db.relationship(
|
|
|
|
| 234 |
return None
|
| 235 |
|
| 236 |
|
| 237 |
+
def record_vote(user_id, text, chosen_model_id, rejected_model_id, model_type,
|
| 238 |
+
session_duration=None, ip_address=None, user_agent=None,
|
| 239 |
+
generation_date=None, cache_hit=None, all_dataset_sentences=None,
|
| 240 |
+
sentence_category=None):
|
| 241 |
"""Record a vote and update Elo ratings."""
|
| 242 |
|
| 243 |
# Determine sentence origin and whether it should count for public leaderboard
|
|
|
|
| 268 |
cache_hit=cache_hit,
|
| 269 |
sentence_hash=sentence_hash,
|
| 270 |
sentence_origin=sentence_origin,
|
| 271 |
+
sentence_category=sentence_category if sentence_category else ('user-generated' if sentence_origin == 'custom' else None),
|
| 272 |
counts_for_public_leaderboard=counts_for_public,
|
| 273 |
)
|
| 274 |
db.session.add(vote)
|
|
|
|
| 637 |
is_active=True,
|
| 638 |
model_url="https://inworld.ai/tts",
|
| 639 |
voice="Ashley",
|
| 640 |
+
api_model_id="inworld-tts-1",
|
| 641 |
),
|
| 642 |
Model(
|
| 643 |
id="inworld-max",
|