Spaces:
Runtime error
Runtime error
Anonymous
commited on
Commit
·
afed1a5
1
Parent(s):
028491e
add files
Browse files
app.py
CHANGED
|
@@ -36,44 +36,44 @@ def get_datasets(task):
|
|
| 36 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
| 37 |
with gr.Row():
|
| 38 |
gr.Markdown("## Multilingual Prompt Generator")
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
with gr.Row():
|
| 50 |
# examples_selection = gr.Dropdown(["English", "Source"], label="examples", value='English')
|
| 51 |
# output_selection = gr.Dropdown(["English", "Source"], label="output", value='English')
|
| 52 |
-
with gr.
|
| 53 |
-
gr.
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
|
| 78 |
generate_button = gr.Button("Generate Prompt")
|
| 79 |
|
|
@@ -216,4 +216,4 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 216 |
)
|
| 217 |
|
| 218 |
if __name__ == '__main__':
|
| 219 |
-
demo.launch(share=True)
|
|
|
|
| 36 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
| 37 |
with gr.Row():
|
| 38 |
gr.Markdown("## Multilingual Prompt Generator")
|
| 39 |
+
|
| 40 |
+
with gr.Accordion(label="Task Details", open=True):
|
| 41 |
+
with gr.Row():
|
| 42 |
+
task = gr.Dropdown(label="Task", choices=list(tasks_datasets.keys()), value=QA)
|
| 43 |
+
language = gr.Dropdown(label="Source Language", choices=languages, value="English")
|
| 44 |
+
model_type = gr.Dropdown(label="Model Type", choices=["Multilingual", "Standard"], value='Multilingual')
|
| 45 |
+
config_recommendation = gr.Button("Recommend Configuration")
|
| 46 |
+
with gr.Row():
|
| 47 |
+
config_prompt = gr.Textbox(label="Recommended Configuration", interactive=False,
|
| 48 |
+
placeholder="Recommended Configuration for this scenerio")
|
| 49 |
with gr.Row():
|
| 50 |
# examples_selection = gr.Dropdown(["English", "Source"], label="examples", value='English')
|
| 51 |
# output_selection = gr.Dropdown(["English", "Source"], label="output", value='English')
|
| 52 |
+
with gr.Accordion(label="Prompt Template", open=True):
|
| 53 |
+
with gr.Column(scale=2):
|
| 54 |
+
# Set the same background style across all components
|
| 55 |
+
with gr.Group(elem_id="prompt-background"):
|
| 56 |
+
instruction = gr.Textbox(label="Instruction")
|
| 57 |
+
with gr.Row(variant="panel"):
|
| 58 |
+
zero_shot = gr.Checkbox(label="Zero Shot Setting", value=False)
|
| 59 |
+
with gr.Accordion("Few Shot - Select Type of Examples ", open=False, visible=True) as few_shot:
|
| 60 |
+
dataset = gr.Dropdown(label="Dataset", choices=tasks_datasets[QA], value="XlSum")
|
| 61 |
+
num_examples = gr.Slider(label="Number of examples in context", minimum=1, maximum=10, step=1,
|
| 62 |
+
value=3)
|
| 63 |
+
with gr.Row(equal_height=True, variant="panel"):
|
| 64 |
+
with gr.Accordion(label="Language Component Selection", open=False):
|
| 65 |
+
prefix_selection = gr.Dropdown(["English", "Source"], label="instruction", value='English')
|
| 66 |
+
context_selection = gr.Dropdown(["English", "Source"], label="context", value='English')
|
| 67 |
+
examples_selection = gr.Dropdown(["English", "Source"], label="examples", value='English')
|
| 68 |
+
output_selection = gr.Dropdown(["English", "Source"], label="output", value='English')
|
| 69 |
+
# Accordion for Few Shot example selection
|
| 70 |
+
with gr.Accordion(label="Prompt Input Data", open=False):
|
| 71 |
+
question = gr.Textbox(label="Question", visible=True)
|
| 72 |
+
context = gr.Textbox(label="Context", visible=True)
|
| 73 |
+
text = gr.Textbox(label="Text", visible=False)
|
| 74 |
+
sentence = gr.Textbox(label="Sentence", visible=False)
|
| 75 |
+
hypothesis = gr.Textbox(label="Hypothesis", visible=False)
|
| 76 |
+
premise = gr.Textbox(label="Premise", visible=False)
|
| 77 |
|
| 78 |
generate_button = gr.Button("Generate Prompt")
|
| 79 |
|
|
|
|
| 216 |
)
|
| 217 |
|
| 218 |
if __name__ == '__main__':
|
| 219 |
+
demo.launch(share=True)
|