Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -18,35 +18,43 @@ model_choices = gr.Dropdown(
|
|
18 |
|
19 |
|
20 |
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
out=ASGAI.
|
|
|
|
|
26 |
else:
|
27 |
-
out=ASGAI.Soft.predictAPI(text)
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
return str(out)
|
32 |
|
33 |
-
def t2seq(text,namn_model):
|
34 |
-
if namn_model=="Group":
|
35 |
-
out=ASGAI.Group.Predict_ALL(text)
|
36 |
-
elif namn_model=="Technique":
|
37 |
-
out=ASGAI.Tec.Predict_ALL(text)
|
38 |
else:
|
39 |
-
out=ASGAI.Soft.Predict_ALL(text)
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
return str(out)
|
44 |
-
with gr.Blocks() as demo:
|
45 |
-
|
46 |
-
T2T = gr.Interface(fn=t2t, inputs=["text",model_choices], outputs="text")
|
47 |
-
T2Seq = gr.Interface(fn=t2seq, inputs=["text",model_choices], outputs="text")
|
48 |
-
demo = gr.TabbedInterface([T2T, T2Seq], ["T2T", "T2Seq"])
|
49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
demo.launch()
|
|
|
52 |
# demo.launch()
|
|
|
18 |
|
19 |
|
20 |
|
21 |
+
import gradio as gr
|
22 |
+
|
23 |
+
def t2t(text, namn_model):
|
24 |
+
if namn_model == "Group":
|
25 |
+
out = ASGAI.Group.predictAPI(text)
|
26 |
+
elif namn_model == "Technique":
|
27 |
+
out = ASGAI.Tec.predictAPI(text)
|
28 |
else:
|
29 |
+
out = ASGAI.Soft.predictAPI(text)
|
|
|
|
|
|
|
30 |
return str(out)
|
31 |
|
32 |
+
def t2seq(text, namn_model):
|
33 |
+
if namn_model == "Group":
|
34 |
+
out = ASGAI.Group.Predict_ALL(text)
|
35 |
+
elif namn_model == "Technique":
|
36 |
+
out = ASGAI.Tec.Predict_ALL(text)
|
37 |
else:
|
38 |
+
out = ASGAI.Soft.Predict_ALL(text)
|
|
|
|
|
|
|
39 |
return str(out)
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
+
# Use Blocks
|
42 |
+
with gr.Blocks() as demo:
|
43 |
+
with gr.TabbedInterface(["T2T", "T2Seq"]):
|
44 |
+
with gr.TabItem("T2T"):
|
45 |
+
text_input = gr.Textbox(label="Input Text")
|
46 |
+
model_choices = gr.Dropdown(choices=["Group", "Technique", "Soft"], label="Model")
|
47 |
+
text_output = gr.Textbox(label="Output")
|
48 |
+
submit_btn = gr.Button("Submit")
|
49 |
+
submit_btn.click(fn=t2t, inputs=[text_input, model_choices], outputs=text_output)
|
50 |
+
|
51 |
+
with gr.TabItem("T2Seq"):
|
52 |
+
text_input_seq = gr.Textbox(label="Input Text")
|
53 |
+
model_choices_seq = gr.Dropdown(choices=["Group", "Technique", "Soft"], label="Model")
|
54 |
+
text_output_seq = gr.Textbox(label="Output")
|
55 |
+
submit_btn_seq = gr.Button("Submit")
|
56 |
+
submit_btn_seq.click(fn=t2seq, inputs=[text_input_seq, model_choices_seq], outputs=text_output_seq)
|
57 |
|
58 |
demo.launch()
|
59 |
+
|
60 |
# demo.launch()
|