Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -112,6 +112,7 @@ Final Response:
|
|
112 |
return prompt
|
113 |
|
114 |
|
|
|
115 |
from gradio_client import Client
|
116 |
def ask_ai(message ):
|
117 |
|
@@ -147,6 +148,8 @@ def t2t(text, namn_model):
|
|
147 |
# anwai=ask_ai(txt)
|
148 |
return txt
|
149 |
|
|
|
|
|
150 |
def t2seq(text, namn_model):
|
151 |
if namn_model == "Group":
|
152 |
out = ASGAI.Group.Predict_ALL(text)
|
@@ -164,6 +167,40 @@ def echo(message, history):
|
|
164 |
text=t2seq(message,"Group")
|
165 |
return text
|
166 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
|
168 |
# Use Blocks
|
169 |
with gr.Blocks() as demo:
|
@@ -219,6 +256,13 @@ with gr.Blocks() as demo:
|
|
219 |
with gr.Tab("T2Sinaro"):
|
220 |
model_choices_seq1 = gr.Dropdown(choices=["Group", "Technique", "Soft"], label="Model",value="Group",)
|
221 |
gr.ChatInterface(fn=echo, title="Echo Bot")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
|
223 |
|
224 |
|
|
|
112 |
return prompt
|
113 |
|
114 |
|
115 |
+
|
116 |
from gradio_client import Client
|
117 |
def ask_ai(message ):
|
118 |
|
|
|
148 |
# anwai=ask_ai(txt)
|
149 |
return txt
|
150 |
|
151 |
+
|
152 |
+
|
153 |
def t2seq(text, namn_model):
|
154 |
if namn_model == "Group":
|
155 |
out = ASGAI.Group.Predict_ALL(text)
|
|
|
167 |
text=t2seq(message,"Group")
|
168 |
return text
|
169 |
|
170 |
+
import uuid
|
171 |
+
|
172 |
+
def s2s(text):
|
173 |
+
userid=str(uuid.uuid4())
|
174 |
+
datase=[]
|
175 |
+
def addsenario(inputs):
|
176 |
+
data, pd = inputs
|
177 |
+
seqtactic = ''
|
178 |
+
seqtec = ''
|
179 |
+
|
180 |
+
for ob in data[0]:
|
181 |
+
seqtactic += ob[0] + "$@"
|
182 |
+
seqtec += ob[1] + "$@"
|
183 |
+
|
184 |
+
out, _ = ASGAI.Soft.predictAPI(seqtec)
|
185 |
+
out2, _ = ASGAI.Group.predictAPI(seqtec + " " + out)
|
186 |
+
|
187 |
+
score = f"{out2}@{out}@{data[1][1]}@{round(data[2], 2)}"
|
188 |
+
|
189 |
+
tutorial = {
|
190 |
+
"seqtactic": seqtactic,
|
191 |
+
"iduser": userid,
|
192 |
+
"seqtec": seqtec,
|
193 |
+
"score": score
|
194 |
+
}
|
195 |
+
datase.append(tutorial)
|
196 |
+
return tutorial
|
197 |
+
ASGAI.cks.onsequens=addsenario
|
198 |
+
|
199 |
+
text_output=ASGAI.search([text],istrans=True,numstop=20)
|
200 |
+
|
201 |
+
|
202 |
+
return str(datase)
|
203 |
+
|
204 |
|
205 |
# Use Blocks
|
206 |
with gr.Blocks() as demo:
|
|
|
256 |
with gr.Tab("T2Sinaro"):
|
257 |
model_choices_seq1 = gr.Dropdown(choices=["Group", "Technique", "Soft"], label="Model",value="Group",)
|
258 |
gr.ChatInterface(fn=echo, title="Echo Bot")
|
259 |
+
|
260 |
+
with gr.Tab("T2Sinaror"):
|
261 |
+
text_input_seqttt = gr.Textbox(label="Input Text")
|
262 |
+
submit_btn_seqtt = gr.Button("Submit")
|
263 |
+
text_out_seqttt = gr.Textbox(label="Input Text")
|
264 |
+
submit_btn_seqtt.click(fn=s2s, inputs=[text_input_seqttt], outputs=text_out_seqttt)
|
265 |
+
|
266 |
|
267 |
|
268 |
|