Spaces:
Sleeping
Sleeping
edbeeching
commited on
Commit
·
976a6d2
1
Parent(s):
ba02fde
fix anonymous
Browse files
app.py
CHANGED
|
@@ -8,9 +8,7 @@ from enum import Enum
|
|
| 8 |
from datasets import get_dataset_infos
|
| 9 |
from transformers import AutoConfig
|
| 10 |
from huggingface_hub import whoami
|
| 11 |
-
from typing import Optional,
|
| 12 |
-
# import threading # DISABLED - was part of hanging database test functions
|
| 13 |
-
# import time # DISABLED - was part of hanging database test functions
|
| 14 |
|
| 15 |
"""
|
| 16 |
Still TODO:
|
|
@@ -121,7 +119,7 @@ def validate_request(request: GenerationRequest, oauth_token: Optional[Union[gr.
|
|
| 121 |
|
| 122 |
if request.num_output_examples > max_samples:
|
| 123 |
if oauth_token is None:
|
| 124 |
-
user_tier = "
|
| 125 |
else:
|
| 126 |
user_tier = "PRO/Enterprise" if is_pro else "free"
|
| 127 |
raise Exception(f"Requested number of output examples {request.num_output_examples} exceeds the max limit of {max_samples} for {user_tier} users.")
|
|
@@ -193,7 +191,7 @@ def validate_request(request: GenerationRequest, oauth_token: Optional[Union[gr.
|
|
| 193 |
if request.top_p < 0.0 or request.top_p > 1.0:
|
| 194 |
raise Exception("Top P must be between 0.0 and 1.0")
|
| 195 |
|
| 196 |
-
# check valid email address TODO: use py3-validate-email https://stackoverflow.com/questions/8022530/how-to-check-for-valid-email-address
|
| 197 |
if "@" not in request.email or "." not in request.email.split("@")[-1]:
|
| 198 |
raise Exception("Invalid email address")
|
| 199 |
|
|
@@ -283,7 +281,7 @@ def get_generation_stats_safe():
|
|
| 283 |
|
| 284 |
def main():
|
| 285 |
with gr.Blocks(title="Synthetic Data Generation") as demo:
|
| 286 |
-
gr.HTML("<h3 style='text-align:center'>Generate synthetic data with AI models. Free to use! Sign
|
| 287 |
|
| 288 |
# Add sign-in button at the top
|
| 289 |
with gr.Row():
|
|
|
|
| 8 |
from datasets import get_dataset_infos
|
| 9 |
from transformers import AutoConfig
|
| 10 |
from huggingface_hub import whoami
|
| 11 |
+
from typing import Optional, Union
|
|
|
|
|
|
|
| 12 |
|
| 13 |
"""
|
| 14 |
Still TODO:
|
|
|
|
| 119 |
|
| 120 |
if request.num_output_examples > max_samples:
|
| 121 |
if oauth_token is None:
|
| 122 |
+
user_tier = "non-signed-in"
|
| 123 |
else:
|
| 124 |
user_tier = "PRO/Enterprise" if is_pro else "free"
|
| 125 |
raise Exception(f"Requested number of output examples {request.num_output_examples} exceeds the max limit of {max_samples} for {user_tier} users.")
|
|
|
|
| 191 |
if request.top_p < 0.0 or request.top_p > 1.0:
|
| 192 |
raise Exception("Top P must be between 0.0 and 1.0")
|
| 193 |
|
| 194 |
+
# check valid email address TODO: could use py3-validate-email https://stackoverflow.com/questions/8022530/how-to-check-for-valid-email-address
|
| 195 |
if "@" not in request.email or "." not in request.email.split("@")[-1]:
|
| 196 |
raise Exception("Invalid email address")
|
| 197 |
|
|
|
|
| 281 |
|
| 282 |
def main():
|
| 283 |
with gr.Blocks(title="Synthetic Data Generation") as demo:
|
| 284 |
+
gr.HTML("<h3 style='text-align:center'>Generate synthetic data with AI models. Free to use! Sign up for PRO benefits (10k samples vs 100). <a href='http://huggingface.co/subscribe/pro?source=synthetic-data-universe' target='_blank'>Upgrade to PRO</a></h3>", elem_id="sub_title")
|
| 285 |
|
| 286 |
# Add sign-in button at the top
|
| 287 |
with gr.Row():
|