Omnibus commited on
Commit
1637cc2
1 Parent(s): 8ac9fae

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -5
app.py CHANGED
@@ -24,7 +24,11 @@ models=[
24
  "psyne/AIResnetClone",
25
 
26
  ]
27
-
 
 
 
 
28
  def aiornot0(image):
29
  labels = ["Real", "AI"]
30
  mod=models[0]
@@ -48,6 +52,8 @@ def aiornot0(image):
48
  for idx,result in enumerate(px):
49
  results[labels[idx]] = px[idx][0]
50
  #results[labels['label']] = result['score']
 
 
51
  return gr.HTML.update(html_out),results
52
  def aiornot1(image):
53
  labels = ["Real", "AI"]
@@ -72,6 +78,8 @@ def aiornot1(image):
72
  for idx,result in enumerate(px):
73
  results[labels[idx]] = px[idx][0]
74
  #results[labels['label']] = result['score']
 
 
75
  return gr.HTML.update(html_out),results
76
  def aiornot2(image):
77
  labels = ["AI", "Real"]
@@ -96,7 +104,8 @@ def aiornot2(image):
96
  results = {}
97
  for idx,result in enumerate(px):
98
  results[labels[idx]] = px[idx][0]
99
- #results[labels['label']] = result['score']
 
100
  return gr.HTML.update(html_out),results
101
  def aiornot3(image):
102
  labels = ["Real", "AI"]
@@ -182,6 +191,10 @@ def load_url(url):
182
  image=None
183
  mes=f"Image not Found<br>Error: {e}"
184
  return image,mes
 
 
 
 
185
  with gr.Blocks() as app:
186
  with gr.Row():
187
  with gr.Column():
@@ -219,9 +232,9 @@ with gr.Blocks() as app:
219
  n_out5=gr.Label(label="Output")
220
  outp5 = gr.HTML("""""")
221
  load_btn.click(load_url,in_url,[inp,mes])
222
- btn.click(aiornot0,[inp],[outp0,n_out0])
223
- btn.click(aiornot1,[inp],[outp1,n_out1])
224
- btn.click(aiornot2,[inp],[outp2,n_out2])
225
  #btn.click(aiornot3,[inp],[outp3,n_out3])
226
  #btn.click(aiornot4,[inp],[outp4,n_out4])
227
  #btn.click(aiornot5,[inp],[outp5,n_out5])
 
24
  "psyne/AIResnetClone",
25
 
26
  ]
27
+
28
+ fin_sum=[]
29
+ #fin_res={f'{uid}':''}
30
+ #fin_sum.append(fin_res)
31
+ #tmp_res=
32
  def aiornot0(image):
33
  labels = ["Real", "AI"]
34
  mod=models[0]
 
52
  for idx,result in enumerate(px):
53
  results[labels[idx]] = px[idx][0]
54
  #results[labels['label']] = result['score']
55
+ tmp_res={f'{uid}-0':results}
56
+ fin_sum.append(tmp_res)
57
  return gr.HTML.update(html_out),results
58
  def aiornot1(image):
59
  labels = ["Real", "AI"]
 
78
  for idx,result in enumerate(px):
79
  results[labels[idx]] = px[idx][0]
80
  #results[labels['label']] = result['score']
81
+ tmp_res={f'{uid}-1':results}
82
+ fin_sum.append(tmp_res)
83
  return gr.HTML.update(html_out),results
84
  def aiornot2(image):
85
  labels = ["AI", "Real"]
 
104
  results = {}
105
  for idx,result in enumerate(px):
106
  results[labels[idx]] = px[idx][0]
107
+ tmp_res={f'{uid}-2':results}
108
+ fin_sum.append(tmp_res)
109
  return gr.HTML.update(html_out),results
110
  def aiornot3(image):
111
  labels = ["Real", "AI"]
 
191
  image=None
192
  mes=f"Image not Found<br>Error: {e}"
193
  return image,mes
194
+
195
+ def tot_prob():
196
+ print (fin_sum)
197
+
198
  with gr.Blocks() as app:
199
  with gr.Row():
200
  with gr.Column():
 
232
  n_out5=gr.Label(label="Output")
233
  outp5 = gr.HTML("""""")
234
  load_btn.click(load_url,in_url,[inp,mes])
235
+ btn.click(aiornot0,[inp],[outp0,n_out0]).then(fin_sum,None,None)
236
+ btn.click(aiornot1,[inp],[outp1,n_out1]).then(fin_sum,None,None)
237
+ btn.click(aiornot2,[inp],[outp2,n_out2]).then(fin_sum,None,None)
238
  #btn.click(aiornot3,[inp],[outp3,n_out3])
239
  #btn.click(aiornot4,[inp],[outp4,n_out4])
240
  #btn.click(aiornot5,[inp],[outp5,n_out5])