Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -29,8 +29,7 @@ def aiornot0(image):
|
|
| 29 |
prediction = logits.argmax(-1).item()
|
| 30 |
label = labels[prediction]
|
| 31 |
html_out = f"""
|
| 32 |
-
<h3>
|
| 33 |
-
<b>This image is likely: {label}</b><br>
|
| 34 |
Model used: <a href='https://huggingface.co/{mod}'>{mod}</a><br>
|
| 35 |
<br>
|
| 36 |
Probabilites:<br>
|
|
@@ -51,8 +50,7 @@ def aiornot1(image):
|
|
| 51 |
prediction = logits.argmax(-1).item()
|
| 52 |
label = labels[prediction]
|
| 53 |
html_out = f"""
|
| 54 |
-
<h3>
|
| 55 |
-
<b>This image is likely: {label}</b><br>
|
| 56 |
Model used: <a href='https://huggingface.co/{mod}'>{mod}</a><br>
|
| 57 |
<br>
|
| 58 |
Probabilites:<br>
|
|
@@ -73,8 +71,7 @@ def aiornot2(image):
|
|
| 73 |
prediction = logits.argmax(-1).item()
|
| 74 |
label = labels[prediction]
|
| 75 |
html_out = f"""
|
| 76 |
-
<h3>
|
| 77 |
-
<b>This image is likely: {label}</b><br>
|
| 78 |
Model used: <a href='https://huggingface.co/{mod}'>{mod}</a><br>
|
| 79 |
<br>
|
| 80 |
Probabilites:<br>
|
|
@@ -82,20 +79,20 @@ def aiornot2(image):
|
|
| 82 |
AI: {px[1][0]}"""
|
| 83 |
return gr.HTML.update(html_out)
|
| 84 |
with gr.Blocks() as app:
|
| 85 |
-
with gr.
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
btn.click(aiornot0,[inp],outp0)
|
| 100 |
btn.click(aiornot1,[inp],outp1)
|
| 101 |
btn.click(aiornot2,[inp],outp2)
|
|
|
|
| 29 |
prediction = logits.argmax(-1).item()
|
| 30 |
label = labels[prediction]
|
| 31 |
html_out = f"""
|
| 32 |
+
<h1>This image is likely: {label}</h1><br><h3>
|
|
|
|
| 33 |
Model used: <a href='https://huggingface.co/{mod}'>{mod}</a><br>
|
| 34 |
<br>
|
| 35 |
Probabilites:<br>
|
|
|
|
| 50 |
prediction = logits.argmax(-1).item()
|
| 51 |
label = labels[prediction]
|
| 52 |
html_out = f"""
|
| 53 |
+
<h1>This image is likely: {label}</h1><br><h3>
|
|
|
|
| 54 |
Model used: <a href='https://huggingface.co/{mod}'>{mod}</a><br>
|
| 55 |
<br>
|
| 56 |
Probabilites:<br>
|
|
|
|
| 71 |
prediction = logits.argmax(-1).item()
|
| 72 |
label = labels[prediction]
|
| 73 |
html_out = f"""
|
| 74 |
+
<h1>This image is likely: {label}</h1><br><h3>
|
|
|
|
| 75 |
Model used: <a href='https://huggingface.co/{mod}'>{mod}</a><br>
|
| 76 |
<br>
|
| 77 |
Probabilites:<br>
|
|
|
|
| 79 |
AI: {px[1][0]}"""
|
| 80 |
return gr.HTML.update(html_out)
|
| 81 |
with gr.Blocks() as app:
|
| 82 |
+
with gr.Column():
|
| 83 |
+
inp = gr.Image()
|
| 84 |
+
btn = gr.Button()
|
| 85 |
+
with gr.Group():
|
| 86 |
+
with gr.Row():
|
| 87 |
+
with gr.Box():
|
| 88 |
+
lab0 = gr.HTML(f"""Testing on Model: {models[0]}""")
|
| 89 |
+
outp0 = gr.HTML("""""")
|
| 90 |
+
with gr.Box():
|
| 91 |
+
lab1 = gr.HTML(f"""Testing on Model: {models[1]}""")
|
| 92 |
+
outp1 = gr.HTML("""""")
|
| 93 |
+
with gr.Box():
|
| 94 |
+
lab2 = gr.HTML(f"""Testing on Model: {models[2]}""")
|
| 95 |
+
outp2 = gr.HTML("""""")
|
| 96 |
btn.click(aiornot0,[inp],outp0)
|
| 97 |
btn.click(aiornot1,[inp],outp1)
|
| 98 |
btn.click(aiornot2,[inp],outp2)
|