Hassan145 commited on
Commit
c3b4ea5
·
1 Parent(s): 011a0f7

updated one

Browse files
Files changed (1) hide show
  1. app.py +17 -8
app.py CHANGED
@@ -42,29 +42,38 @@ def predict(img: Image.Image) -> Tuple[Dict[str, float], float]:
42
 
43
  # 5. Build the Gradio interface
44
  with gr.Blocks() as demo:
45
- gr.HTML("<h1 style='text-align: center'>Vegetable Classification with ResNet18</h1>")
46
  gr.HTML("""
47
- <h3 style='text-align: center'>
48
- Created by <a href='https://github.com/ExplorerGumel' target='_blank'>@ExplorerGumel</a>
49
- </h3>
 
 
 
 
 
 
 
 
50
  """)
51
 
52
  with gr.Row():
53
  with gr.Column():
54
- image_input = gr.Image(type="pil", label="Upload Image")
55
- predict_button = gr.Button("Predict")
56
 
 
57
  examples = []
58
  if os.path.exists("examples"):
59
  examples = [["examples/" + fname] for fname in os.listdir("examples") if fname.lower().endswith((".png", ".jpg", ".jpeg"))]
60
  gr.Examples(examples=examples, inputs=[image_input])
61
 
62
  with gr.Column():
63
- output_label = gr.Label(num_top_classes=4, label="Predictions")
64
- output_time = gr.Number(label="Prediction Time (seconds)")
65
 
66
  predict_button.click(fn=predict, inputs=image_input, outputs=[output_label, output_time])
67
 
68
  # 6. Launch the app
69
  demo.launch()
70
 
 
 
42
 
43
  # 5. Build the Gradio interface
44
  with gr.Blocks() as demo:
 
45
  gr.HTML("""
46
+ <div style="background-image: url('https://images.unsplash.com/photo-1501004318641-b39e6451bec6');
47
+ background-size: cover;
48
+ padding: 25px;
49
+ border-radius: 10px;
50
+ color: white;
51
+ font-family: 'Poppins', sans-serif;">
52
+ <h1 style='text-align: center;'>🌾 Vegetable Classifier with ResNet18 🌾</h1>
53
+ <h3 style='text-align: center;'>
54
+ Created by <a href='https://github.com/ExplorerGumel' target='_blank' style='color: #f0e68c;'>@ExplorerGumel</a>
55
+ </h3>
56
+ </div>
57
  """)
58
 
59
  with gr.Row():
60
  with gr.Column():
61
+ image_input = gr.Image(type="pil", label="📸 Upload Vegetable Image")
62
+ predict_button = gr.Button("🔍 Predict")
63
 
64
+
65
  examples = []
66
  if os.path.exists("examples"):
67
  examples = [["examples/" + fname] for fname in os.listdir("examples") if fname.lower().endswith((".png", ".jpg", ".jpeg"))]
68
  gr.Examples(examples=examples, inputs=[image_input])
69
 
70
  with gr.Column():
71
+ output_label = gr.Label(num_top_classes=4, label="🌽 Predictions")
72
+ output_time = gr.Number(label="⏱️ Prediction Time (seconds)")
73
 
74
  predict_button.click(fn=predict, inputs=image_input, outputs=[output_label, output_time])
75
 
76
  # 6. Launch the app
77
  demo.launch()
78
 
79
+