Spaces:
Sleeping
Sleeping
emielclopterop
commited on
Commit
•
cd5c11b
1
Parent(s):
8623a55
Update app.py
Browse files
app.py
CHANGED
@@ -7,7 +7,7 @@ def load_qa_model():
|
|
7 |
return pipeline("question-answering", model="bert-large-uncased-whole-word-masking-finetuned-squad")
|
8 |
|
9 |
def load_classifier_model():
|
10 |
-
return pipeline("
|
11 |
|
12 |
def load_translator_model(target_language):
|
13 |
try:
|
@@ -91,7 +91,7 @@ with gr.Blocks() as demo:
|
|
91 |
with gr.Tab("Single-Models"):
|
92 |
gr.Markdown("This tab is for single models demonstration.")
|
93 |
|
94 |
-
task_select_single = gr.Dropdown(["Question Answering", "
|
95 |
input_text_single = gr.Textbox(label="Input Text")
|
96 |
|
97 |
# Additional inputs for specific tasks
|
@@ -109,7 +109,7 @@ with gr.Blocks() as demo:
|
|
109 |
label_input_single: gr.update(visible=False),
|
110 |
target_language_input_single: gr.update(visible=False)
|
111 |
}
|
112 |
-
elif task == "
|
113 |
return {
|
114 |
context_input_single: gr.update(visible=False),
|
115 |
label_input_single: gr.update(visible=True),
|
@@ -146,7 +146,7 @@ with gr.Blocks() as demo:
|
|
146 |
def execute_task_single(task, input_text, context, labels, target_language):
|
147 |
if task == "Question Answering":
|
148 |
return process_qa(context=context, question=input_text)
|
149 |
-
elif task == "
|
150 |
if not labels:
|
151 |
return "Please provide labels for classification."
|
152 |
return process_classifier(text=input_text, labels=labels)
|
|
|
7 |
return pipeline("question-answering", model="bert-large-uncased-whole-word-masking-finetuned-squad")
|
8 |
|
9 |
def load_classifier_model():
|
10 |
+
return pipeline("zero-shot-classification", model="MoritzLaurer/deberta-v3-base-zeroshot-v1.1-all-33")
|
11 |
|
12 |
def load_translator_model(target_language):
|
13 |
try:
|
|
|
91 |
with gr.Tab("Single-Models"):
|
92 |
gr.Markdown("This tab is for single models demonstration.")
|
93 |
|
94 |
+
task_select_single = gr.Dropdown(["Question Answering", "Zero-Shot Classification", "Translation", "Text Generation", "Summarization"], label="Select Task")
|
95 |
input_text_single = gr.Textbox(label="Input Text")
|
96 |
|
97 |
# Additional inputs for specific tasks
|
|
|
109 |
label_input_single: gr.update(visible=False),
|
110 |
target_language_input_single: gr.update(visible=False)
|
111 |
}
|
112 |
+
elif task == "Zero-Shot Classification":
|
113 |
return {
|
114 |
context_input_single: gr.update(visible=False),
|
115 |
label_input_single: gr.update(visible=True),
|
|
|
146 |
def execute_task_single(task, input_text, context, labels, target_language):
|
147 |
if task == "Question Answering":
|
148 |
return process_qa(context=context, question=input_text)
|
149 |
+
elif task == "Zero-Shot Classification":
|
150 |
if not labels:
|
151 |
return "Please provide labels for classification."
|
152 |
return process_classifier(text=input_text, labels=labels)
|