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