Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -512,7 +512,8 @@ def translate_dataset(train_url, local_parquet_path, input_file_path, output_fil
|
|
512 |
logging.basicConfig(level=logging.INFO, filename='translation.log', filemode='a',
|
513 |
format='%(asctime)s - %(levelname)s - %(message)s')
|
514 |
|
515 |
-
|
|
|
516 |
try:
|
517 |
# Login to Hugging Face
|
518 |
token = login()
|
@@ -543,7 +544,7 @@ def main(model_id, dataset_url, model_type, output_dataset_name):
|
|
543 |
"input_file": f"{model_type}_en.jsonl",
|
544 |
"output_file": f"{model_type}_de.jsonl",
|
545 |
"raw_file": f"{model_type}_de_raw.jsonl",
|
546 |
-
"range_spec":
|
547 |
"model_type": model_type
|
548 |
}
|
549 |
|
@@ -589,6 +590,7 @@ with gr.Blocks() as demo:
|
|
589 |
dataset_url = gr.Textbox(label="Dataset URL", lines=1)
|
590 |
model_type = gr.Dropdown(choices=["mix", "orpo", "ufb"], label="Model Type")
|
591 |
output_dataset_name = gr.Textbox(label="Output Dataset Name", lines=1)
|
|
|
592 |
login_button = gr.Button("Login to Hugging Face")
|
593 |
|
594 |
with gr.Column():
|
@@ -596,6 +598,6 @@ with gr.Blocks() as demo:
|
|
596 |
logout_button = gr.Button("Logout")
|
597 |
|
598 |
submit_btn = gr.Button("Translate Dataset", variant="primary")
|
599 |
-
submit_btn.click(main, inputs=[model_id, dataset_url, model_type, output_dataset_name], outputs=output)
|
600 |
|
601 |
demo.launch()
|
|
|
512 |
logging.basicConfig(level=logging.INFO, filename='translation.log', filemode='a',
|
513 |
format='%(asctime)s - %(levelname)s - %(message)s')
|
514 |
|
515 |
+
# Main function to handle the translation workflow
|
516 |
+
def main(model_id, dataset_url, model_type, output_dataset_name, range_specification):
|
517 |
try:
|
518 |
# Login to Hugging Face
|
519 |
token = login()
|
|
|
544 |
"input_file": f"{model_type}_en.jsonl",
|
545 |
"output_file": f"{model_type}_de.jsonl",
|
546 |
"raw_file": f"{model_type}_de_raw.jsonl",
|
547 |
+
"range_spec": range_specification,
|
548 |
"model_type": model_type
|
549 |
}
|
550 |
|
|
|
590 |
dataset_url = gr.Textbox(label="Dataset URL", lines=1)
|
591 |
model_type = gr.Dropdown(choices=["mix", "orpo", "ufb"], label="Model Type")
|
592 |
output_dataset_name = gr.Textbox(label="Output Dataset Name", lines=1)
|
593 |
+
range_specification = gr.Textbox(label="Range Specification", lines=1, placeholder="e.g., 1-100, 200-250")
|
594 |
login_button = gr.Button("Login to Hugging Face")
|
595 |
|
596 |
with gr.Column():
|
|
|
598 |
logout_button = gr.Button("Logout")
|
599 |
|
600 |
submit_btn = gr.Button("Translate Dataset", variant="primary")
|
601 |
+
submit_btn.click(main, inputs=[model_id, dataset_url, model_type, output_dataset_name, range_specification], outputs=output)
|
602 |
|
603 |
demo.launch()
|