dash-asg / app.py
wasmdashai's picture
Update app.py
add7b09 verified
raw
history blame
2.19 kB
import gradio as gr
import sys
sys.path.insert(0, "ASG.API/")
from ASGModels import ASG
ASGAI=ASG(isForm=False)
choices=[
"Group",
"Technique",
"Software"
]
model_choices = gr.Dropdown(
choices=choices,
label="اختر النموذج",
value="Group",
)
import gradio as gr
def t2t(text, namn_model):
if namn_model == "Group":
out = ASGAI.Group.predictAPI(text)
elif namn_model == "Technique":
out = ASGAI.Tec.predictAPI(text)
else:
out = ASGAI.Soft.predictAPI(text)
return str(out)
def t2seq(text, namn_model):
if namn_model == "Group":
out = ASGAI.Group.Predict_ALL(text)
elif namn_model == "Technique":
out = ASGAI.Tec.Predict_ALL(text)
else:
out = ASGAI.Soft.Predict_ALL(text)
return str(out)
# Use Blocks
with gr.Blocks() as demo:
with gr.Row():
with gr.Tab("Thread Base"):
gr.Markdown("### Thread Base")
with gr.Row():
with gr.Tab("T2T"):
text_input = gr.Textbox(label="Input Text")
model_choices = gr.Dropdown(choices=["Group", "Technique", "Soft"], label="Model")
text_output = gr.Textbox(label="Output")
submit_btn = gr.Button("Submit")
submit_btn.click(fn=t2t, inputs=[text_input, model_choices], outputs=text_output)
with gr.Tab("T2Seq"):
text_input_seq = gr.Textbox(label="Input Text")
model_choices_seq = gr.Dropdown(choices=["Group", "Technique", "Soft"], label="Model")
text_output_seq = gr.Textbox(label="Output")
submit_btn_seq = gr.Button("Submit")
submit_btn_seq.click(fn=t2seq, inputs=[text_input_seq, model_choices_seq], outputs=text_output_seq)
with gr.Tab("Stute Base"):
gr.Markdown("### Stute Base")
demo.launch()
# demo.launch()