Parveshiiii commited on
Commit
1a87155
·
verified ·
1 Parent(s): b76a19e

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +33 -0
  2. requirements.txt +4 -0
app.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ classifier = pipeline("image-classification", model="XenArcAI/AIRealNet")
5
+
6
+ def recognize(img):
7
+ results = classifier(img)
8
+ return {r["label"]: round(r["score"], 3) for r in results}
9
+
10
+ with gr.Blocks() as demo: # removed theme for compatibility
11
+ gr.Markdown(
12
+ """
13
+ # **XenArcAI**
14
+ # 🖼️ AIRealNet Image Recognition
15
+ Upload an image and let **AIRealNet** identify what's inside.
16
+ """
17
+ )
18
+
19
+ with gr.Row():
20
+ with gr.Column():
21
+ inp = gr.Image(type="pil", label="Upload Image")
22
+ btn = gr.Button("Run Recognition")
23
+ with gr.Column():
24
+ out = gr.Label(num_top_classes=2, label="Predictions")
25
+
26
+ examples = gr.Examples(
27
+ examples=["examples/cat.jpg", "examples/dog.jpg", "examples/car.jpg"],
28
+ inputs=inp
29
+ )
30
+
31
+ btn.click(fn=recognize, inputs=inp, outputs=[out])
32
+
33
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ torch
2
+ transformers
3
+ safetensors
4
+ gradio