SiyaYan commited on
Commit
6f68014
Β·
verified Β·
1 Parent(s): 7382153

add more example

Browse files
Files changed (1) hide show
  1. app.py +10 -5
app.py CHANGED
@@ -139,10 +139,15 @@ def predict(img):
139
  # Gradio UI (Webcam + Upload)
140
  # ============================
141
  ds = load_dataset("TristanKE/RemainingLifespanPredictionFaces", split="train")
142
- sample = ds[1]
143
- img, target = sample["image"], sample["remaining_lifespan"]
144
- img.save("example.jpg")
145
-
 
 
 
 
 
146
 
147
  demo = gr.Interface(
148
  fn=predict,
@@ -151,7 +156,7 @@ demo = gr.Interface(
151
  live=False,
152
  title="Lifespan Predictor (Demo)",
153
  description="Upload or take a face photo. Model predicts remaining lifespan (years).",
154
- examples=[["example.jpg"]], # πŸ‘ˆ make sure example.jpg exists in repo
155
  css="""
156
  #pred-box {
157
  height: 500px; /* fixed height to match image */
 
139
  # Gradio UI (Webcam + Upload)
140
  # ============================
141
  ds = load_dataset("TristanKE/RemainingLifespanPredictionFaces", split="train")
142
+ sample1 = ds[1]
143
+ img1= sample1["image"]
144
+ img1.save("example1.jpg")
145
+ sample2 = ds[2]
146
+ img2= sample2["image"]
147
+ img2.save("example2.jpg")
148
+ sample3 = ds[3]
149
+ img3= sample3["image"]
150
+ img3.save("example3.jpg")
151
 
152
  demo = gr.Interface(
153
  fn=predict,
 
156
  live=False,
157
  title="Lifespan Predictor (Demo)",
158
  description="Upload or take a face photo. Model predicts remaining lifespan (years).",
159
+ examples=[["example1.jpg"],["example2.jpg"],["example3.jpg"]], # πŸ‘ˆ make sure example.jpg exists in repo
160
  css="""
161
  #pred-box {
162
  height: 500px; /* fixed height to match image */