File size: 7,217 Bytes
9c3d10b
c824607
 
 
 
 
 
b8284a1
 
 
 
 
 
 
 
 
 
9c3d10b
b8284a1
 
3fde40c
4cc64ba
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3fde40c
 
 
 
 
b8284a1
3fde40c
a5cf614
9c3d10b
3fde40c
 
 
 
 
e363c7d
3fde40c
e363c7d
aa40e0e
167ff63
 
aa40e0e
e363c7d
3fde40c
 
4cc64ba
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
add7b09
4cc64ba
 
add7b09
 
 
aa40e0e
add7b09
 
aa40e0e
add7b09
 
 
 
 
 
aa40e0e
add7b09
 
 
 
aa40e0e
167ff63
aa40e0e
 
167ff63
aa40e0e
add7b09
1536913
add7b09
c3f6c7c
 
3fde40c
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
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 home_page():
    return """
    <div class="px-4 py-5 my-5 text-center">
    <img class="d-block mx-auto mb-4" src="/docs/5.0/assets/brand/bootstrap-logo.svg" alt="" width="72" height="57">
    <h1 class="display-5 fw-bold">مرحباً بك في Model AI ASG
 </h1>
    <div class="col-lg-6 mx-auto">
      <p class="lead mb-4">
      Wasm-Speeker We provide models that help to aid in the creation of different attack sequences. You can deal with AGS models by choosing the model you want. We provide models that help to aid in the creation of different attack sequences. You can deal with AGS models by choosing the model you want.      </p>
      <div class="d-grid gap-2 d-sm-flex justify-content-sm-center">
        <button type="button" class="btn btn-primary btn-lg px-4 gap-3">Primary button</button>
        <button type="button" class="btn btn-outline-secondary btn-lg px-4">Secondary</button>
      </div>
    </div>
  </div>
  
    <div class="container col-xxl-8 px-4 py-5">
    <div class="row flex-lg-row-reverse align-items-center g-5 py-5">
      <div class="col-10 col-sm-8 col-lg-6">
        <img src="bootstrap-themes.png" class="d-block mx-lg-auto img-fluid" alt="Bootstrap Themes" width="700" height="500" loading="lazy">
      </div>
      <div class="col-lg-6">
        <h1 class="display-5 fw-bold lh-1 mb-3">Responsive left-aligned hero with image</h1>
        <p class="lead">Quickly design and customize responsive mobile-first sites with Bootstrap, the world’s most popular front-end open source toolkit, featuring Sass variables and mixins, responsive grid system, extensive prebuilt components, and powerful JavaScript plugins.</p>
        <div class="d-grid gap-2 d-md-flex justify-content-md-start">
          <button type="button" class="btn btn-primary btn-lg px-4 me-md-2">Primary</button>
          <button type="button" class="btn btn-outline-secondary btn-lg px-4">Default</button>
        </div>
      </div>
    </div>
  </div>
  <div class="row p-4 pb-0 pe-lg-0 pt-lg-5 align-items-center rounded-3 border shadow-lg">
      <div class="col-lg-7 p-3 p-lg-5 pt-lg-3">
        <h1 class="display-4 fw-bold lh-1">Border hero with cropped image and shadows</h1>
        <p class="lead">Quickly design and customize responsive mobile-first sites with Bootstrap, the world’s most popular front-end open source toolkit, featuring Sass variables and mixins, responsive grid system, extensive prebuilt components, and powerful JavaScript plugins.</p>
        <div class="d-grid gap-2 d-md-flex justify-content-md-start mb-4 mb-lg-3">
          <button type="button" class="btn btn-primary btn-lg px-4 me-md-2 fw-bold">Primary</button>
          <button type="button" class="btn btn-outline-secondary btn-lg px-4">Default</button>
        </div>
      </div>
      <div class="col-lg-4 offset-lg-1 p-0 overflow-hidden shadow-lg">
          <img class="rounded-lg-3" src="bootstrap-docs.png" alt="" width="720">
      </div>
    </div>
   <div class="bg-dark text-secondary px-4 py-5 text-center">
    <div >
      <h1 class="display-5 fw-bold text-white">Dark mode hero</h1>
      <div class="col-lg-6 mx-auto">
        <p class="fs-5 mb-4">Quickly design and customize responsive mobile-first sites with Bootstrap, the world’s most popular front-end open source toolkit, featuring Sass variables and mixins, responsive grid system, extensive prebuilt components, and powerful JavaScript plugins.</p>
        <div class="d-grid gap-2 d-sm-flex justify-content-sm-center">
          <button type="button" class="btn btn-outline-info btn-lg px-4 me-sm-3 fw-bold">Custom button</button>
          <button type="button" class="btn btn-outline-light btn-lg px-4">Secondary</button>
        </div>
      </div>
    </div>
  </div>
    """
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)
def echo(message, history):
    text=t2seq(message,"Group")
    return text


# Use Blocks
with gr.Blocks() as demo:
    gr.HTML("""
    <head>
        <!-- Required meta tags -->
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <!-- Bootstrap CSS -->
        <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">

        <title> Model AI ASG</title>
    </head>
    """)

    # العنوان الرئيسي
    gr.Markdown("# Model AI ASG")
    

    # عرض الصورة الترحيبية
    gr.Image("icon (1).jpg", label="Model AI ASG")
    gr.HTML("""
    <style>
    .gradio-tabs {
        direction: rtl;
    }
    </style>
    """)
    
    with gr.Row():
        with gr.Tab("Home"):
            gr.HTML(home_page())
        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",value="Group",)
                        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",value="Group",)
                        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("T2Sinaro"):
                    model_choices_seq1 = gr.Dropdown(choices=["Group", "Technique", "Soft"], label="Model",value="Group",)
                    gr.ChatInterface(fn=echo, examples=["hello", "hola", "merhaba"], title="Echo Bot")
                    
                    

                    
        with gr.Tab("Stute Base"):
                gr.Markdown("### Stute Base")

demo.launch()

# demo.launch()