Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -20,6 +20,30 @@ def predict_image(image):
|
|
| 20 |
prediction = classifier.predict(image)
|
| 21 |
return prediction[0]
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
imagenes_muestra =[
|
| 24 |
"knnExample/0.png"
|
| 25 |
"knnExample/5.png"
|
|
|
|
| 20 |
prediction = classifier.predict(image)
|
| 21 |
return prediction[0]
|
| 22 |
|
| 23 |
+
with gr.Blocks() as demo:
|
| 24 |
+
txt = gr.Textbox(label = "Input", lines =2)
|
| 25 |
+
txt_2 = gr.Textbox(label = "Input 2")
|
| 26 |
+
txt_3 = gr.Textbox(value = "", label = "Output")
|
| 27 |
+
btn = gr.Button(value = "submit")
|
| 28 |
+
btn.click(combine, inputs = [txt, txt_2]), outputs = [txt_3]
|
| 29 |
+
|
| 30 |
+
with gr.Row():
|
| 31 |
+
im = gr.Image()
|
| 32 |
+
im_2 = gr.Image()
|
| 33 |
+
|
| 34 |
+
btn = gr.Button(value = "Mirror image")
|
| 35 |
+
btn.click(mirror, inputs = [im], outputs = [im_2])
|
| 36 |
+
|
| 37 |
+
gr.Markdown("## Image Examples")
|
| 38 |
+
gr.Examples(
|
| 39 |
+
examples=[os.path.join(os.path.dirname(__file__), "0.png")],
|
| 40 |
+
inputs=im,
|
| 41 |
+
outputs=im_2,
|
| 42 |
+
fn=mirror,
|
| 43 |
+
cache_examples=True,
|
| 44 |
+
)
|
| 45 |
+
|
| 46 |
+
|
| 47 |
imagenes_muestra =[
|
| 48 |
"knnExample/0.png"
|
| 49 |
"knnExample/5.png"
|