Omnibus commited on
Commit
5c55b9f
·
1 Parent(s): a5f5738

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -3
app.py CHANGED
@@ -33,8 +33,16 @@ def aiornot0(image):
33
  print(px)
34
 
35
  prediction = logits.argmax(-1).item()
36
- label = labels[prediction]
37
- return gr.BarPlot.update(label=f'{models[0]}', vertical=False,value=px, x=px,y=labels)
 
 
 
 
 
 
 
 
38
  def aiornot1(image):
39
  labels = ["Real", "AI"]
40
  mod=models[1]
@@ -72,7 +80,7 @@ with gr.Blocks() as app:
72
 
73
  with gr.Column():
74
  #outp0 = gr.Textbox(label=f'{models[0]}')
75
- outp0 = gr.BarPlot(label=f'{models[0]}', vertical=False)
76
  outp1 = gr.Textbox(label=f'{models[1]}')
77
  outp2 = gr.Textbox(label=f'{models[2]}')
78
  btn.click(aiornot0,[inp],outp0)
 
33
  print(px)
34
 
35
  prediction = logits.argmax(-1).item()
36
+ label = labels[prediction]
37
+
38
+ html_out = f"""
39
+ <h3>Model used: <a href src='https://huggingface.co/models/{mod}'>{mod}</a><br>
40
+ This image is likely: {label}<br>
41
+ Probabilites<br>
42
+ AI: {px[0]}<br>
43
+ Real: {px[1]}"""
44
+
45
+ return gr.update(html_out)
46
  def aiornot1(image):
47
  labels = ["Real", "AI"]
48
  mod=models[1]
 
80
 
81
  with gr.Column():
82
  #outp0 = gr.Textbox(label=f'{models[0]}')
83
+ outp0 = gr.HTML("""""")
84
  outp1 = gr.Textbox(label=f'{models[1]}')
85
  outp2 = gr.Textbox(label=f'{models[2]}')
86
  btn.click(aiornot0,[inp],outp0)