File size: 1,250 Bytes
9c3d10b
c824607
 
 
 
 
 
b8284a1
 
 
 
 
 
 
 
 
 
9c3d10b
b8284a1
 
e363c7d
b8284a1
7c2d1cf
b8284a1
7c2d1cf
b8284a1
7c2d1cf
b8284a1
 
 
a5cf614
9c3d10b
e363c7d
 
 
 
 
 
 
 
 
 
 
 
8c46f74
 
e363c7d
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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()