Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,38 @@
|
|
1 |
import gradio as gr
|
2 |
-
from
|
3 |
-
from pipeline_utils import handle_task_change, review_training_choices, test_pipeline
|
4 |
-
from playground_utils import create_playground_header, create_playground_footer, create_tabs_header
|
5 |
|
6 |
playground = gr.Blocks()
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
with playground:
|
9 |
create_playground_header()
|
10 |
with gr.Tabs():
|
@@ -13,8 +41,7 @@ with playground:
|
|
13 |
with gr.Row(visible=True) as use_pipeline:
|
14 |
with gr.Column():
|
15 |
task_dropdown = gr.Dropdown(
|
16 |
-
choices=
|
17 |
-
for task_id, task in tasks_config.items()],
|
18 |
label="Task",
|
19 |
interactive=True,
|
20 |
info="Select Pipelines for natural language processing tasks or type if you have your own."
|
@@ -44,7 +71,8 @@ with playground:
|
|
44 |
inputs=radio, outputs=use_pipeline)
|
45 |
test_pipeline_button.click(test_pipeline,
|
46 |
inputs=[
|
47 |
-
task_dropdown, model_dropdown, prompt_textarea,
|
|
|
48 |
outputs=text)
|
49 |
with gr.TabItem("Image"):
|
50 |
radio, test_pipeline_button = create_tabs_header()
|
|
|
1 |
import gradio as gr
|
2 |
+
from pipeline_utils import task_dropdown_choices, handle_task_change, review_training_choices, test_pipeline
|
|
|
|
|
3 |
|
4 |
playground = gr.Blocks()
|
5 |
|
6 |
+
|
7 |
+
def create_playground_header():
|
8 |
+
gr.Markdown("""
|
9 |
+
# π€ Hugging Face Playground
|
10 |
+
**Try your ideas here. Select from Text, Image or Audio**
|
11 |
+
""")
|
12 |
+
|
13 |
+
|
14 |
+
def create_playground_footer():
|
15 |
+
gr.Markdown("""
|
16 |
+
### To Learn More about π€ Hugging Face,[Click Here](https://huggingface.co/docs)
|
17 |
+
### [Click Here](https://huggingface.co/spaces/nsethi610/ns-gradio-apps/discussions/1) to provide Feedback, or participate in development of this tool.Let's make AI easy for everyone.
|
18 |
+
""")
|
19 |
+
|
20 |
+
|
21 |
+
def create_tabs_header():
|
22 |
+
with gr.Row():
|
23 |
+
with gr.Column(scale=4):
|
24 |
+
radio = gr.Radio(
|
25 |
+
["Use Pipeline", "Fine Tune"],
|
26 |
+
label="Select Use Pipeline to try out HF models or Fine Tune to test it on your own datasets",
|
27 |
+
value="Use Pipeline",
|
28 |
+
interactive=True,
|
29 |
+
)
|
30 |
+
with gr.Column(scale=1):
|
31 |
+
test_pipeline_button = gr.Button(
|
32 |
+
value="Test", variant="primary", size="sm")
|
33 |
+
return radio, test_pipeline_button
|
34 |
+
|
35 |
+
|
36 |
with playground:
|
37 |
create_playground_header()
|
38 |
with gr.Tabs():
|
|
|
41 |
with gr.Row(visible=True) as use_pipeline:
|
42 |
with gr.Column():
|
43 |
task_dropdown = gr.Dropdown(
|
44 |
+
choices=task_dropdown_choices(),
|
|
|
45 |
label="Task",
|
46 |
interactive=True,
|
47 |
info="Select Pipelines for natural language processing tasks or type if you have your own."
|
|
|
71 |
inputs=radio, outputs=use_pipeline)
|
72 |
test_pipeline_button.click(test_pipeline,
|
73 |
inputs=[
|
74 |
+
task_dropdown, model_dropdown, prompt_textarea,
|
75 |
+
context_for_question_answer],
|
76 |
outputs=text)
|
77 |
with gr.TabItem("Image"):
|
78 |
radio, test_pipeline_button = create_tabs_header()
|