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", ) 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) tab1 = gr.Interface(fn=t2t, inputs=["text",model_choices], outputs="text") tab2 = gr.Interface(fn=t2seq, inputs=["text",model_choices], outputs="text") import gradio as gr demo = gr.TabbedInterface([tab1, tab2], ["T2T", "T2Seq"]) if __name__ == "__main__": demo.launch() # demo.launch()