Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -576,7 +576,7 @@ gradio_desc = """This tool translates datasets using the WMT21 translation model
|
|
| 576 |
## π What Does This Tool Do:
|
| 577 |
- Translates datasets based on the selected model type.
|
| 578 |
- Uploads the translated dataset to Hugging Face.
|
| 579 |
-
## π Dataset
|
| 580 |
- **mix**:
|
| 581 |
- `prompt`: List of dictionaries with 'content' and 'role' fields (multi-turn conversation).
|
| 582 |
- `chosen`: Single dictionary with 'content' and 'role' fields.
|
|
@@ -592,24 +592,32 @@ gradio_desc = """This tool translates datasets using the WMT21 translation model
|
|
| 592 |
## π οΈ Backend:
|
| 593 |
The translation backend runs on the Hugging Face Hub API.
|
| 594 |
"""
|
|
|
|
|
|
|
| 595 |
|
| 596 |
-
with gr.Blocks() as demo:
|
| 597 |
gr.HTML(f"""<h1 align="center" id="space-title">{gradio_title}</h1>""")
|
| 598 |
gr.Markdown(gradio_desc)
|
| 599 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 600 |
with gr.Row(equal_height=False):
|
| 601 |
with gr.Column():
|
| 602 |
-
dataset_url = gr.Textbox(label="Dataset URL", lines=1)
|
| 603 |
-
model_type = gr.Dropdown(choices=["mix", "orpo", "ufb"], label="
|
| 604 |
output_dataset_name = gr.Textbox(label="Output Dataset Name", lines=1)
|
| 605 |
range_specification = gr.Textbox(label="Range Specification", lines=1, placeholder="e.g., 1-100")
|
| 606 |
-
login_button = gr.Button("Login to Hugging Face")
|
| 607 |
|
| 608 |
with gr.Column():
|
| 609 |
output = gr.Textbox(label="Output", lines=1)
|
| 610 |
-
logout_button = gr.Button("Logout")
|
| 611 |
|
| 612 |
submit_btn = gr.Button("Translate Dataset", variant="primary")
|
| 613 |
-
submit_btn.click(main, inputs=[dataset_url, model_type, output_dataset_name, range_specification], outputs=output)
|
|
|
|
|
|
|
| 614 |
|
| 615 |
-
demo.launch()
|
|
|
|
| 576 |
## π What Does This Tool Do:
|
| 577 |
- Translates datasets based on the selected model type.
|
| 578 |
- Uploads the translated dataset to Hugging Face.
|
| 579 |
+
## π Dataset Types:
|
| 580 |
- **mix**:
|
| 581 |
- `prompt`: List of dictionaries with 'content' and 'role' fields (multi-turn conversation).
|
| 582 |
- `chosen`: Single dictionary with 'content' and 'role' fields.
|
|
|
|
| 592 |
## π οΈ Backend:
|
| 593 |
The translation backend runs on the Hugging Face Hub API.
|
| 594 |
"""
|
| 595 |
+
# Define the theme
|
| 596 |
+
theme = gr.themes.Soft(text_size="lg", spacing_size="lg")
|
| 597 |
|
| 598 |
+
with gr.Blocks(theme=theme) as demo:
|
| 599 |
gr.HTML(f"""<h1 align="center" id="space-title">{gradio_title}</h1>""")
|
| 600 |
gr.Markdown(gradio_desc)
|
| 601 |
|
| 602 |
+
with gr.Row(variant="panel"):
|
| 603 |
+
gr.Markdown(value="## π Login to Hugging Face"),
|
| 604 |
+
token_input = gr.LoginButton(min_width=380)
|
| 605 |
+
|
| 606 |
+
gr.Markdown(value="π¨ **This is needed to upload the resulting dataset.**")
|
| 607 |
+
|
| 608 |
with gr.Row(equal_height=False):
|
| 609 |
with gr.Column():
|
| 610 |
+
dataset_url = gr.Textbox(label="Input Dataset URL", lines=1)
|
| 611 |
+
model_type = gr.Dropdown(choices=["mix", "orpo", "ufb"], label="Dataset Type")
|
| 612 |
output_dataset_name = gr.Textbox(label="Output Dataset Name", lines=1)
|
| 613 |
range_specification = gr.Textbox(label="Range Specification", lines=1, placeholder="e.g., 1-100")
|
|
|
|
| 614 |
|
| 615 |
with gr.Column():
|
| 616 |
output = gr.Textbox(label="Output", lines=1)
|
|
|
|
| 617 |
|
| 618 |
submit_btn = gr.Button("Translate Dataset", variant="primary")
|
| 619 |
+
submit_btn.click(main, inputs=[dataset_url, model_type, output_dataset_name, range_specification, token_input], outputs=output)
|
| 620 |
+
|
| 621 |
+
gr.Markdown(value="We sincerely thank our community members for their extraordinary contributions to this project.")
|
| 622 |
|
| 623 |
+
demo.launch(share=True)
|