halictus commited on
Commit
2466430
·
verified ·
1 Parent(s): e3f40a0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -10,7 +10,7 @@ classifier = pipeline("image-classification", model=model_id)
10
  def classify_image_from_url(image_url: str):
11
  """
12
  Downloads an image from a public URL and runs it through
13
- the ResNet-50 image-classification pipeline, returning the top predictions.
14
  """
15
  try:
16
  response = requests.get(image_url)
@@ -22,7 +22,7 @@ def classify_image_from_url(image_url: str):
22
 
23
  # Format scores to remove scientific notation
24
  for r in results:
25
- r["score"] = float(f"{r['score']:.8f}")
26
 
27
  return results
28
 
@@ -34,7 +34,7 @@ demo = gr.Interface(
34
  inputs=gr.Textbox(lines=1, label="Image URL"),
35
  outputs="json",
36
  title="ResNet-50 Image Classifier",
37
- description="Enter a public image URL to get top predictions."
38
  )
39
 
40
  if __name__ == "__main__":
 
10
  def classify_image_from_url(image_url: str):
11
  """
12
  Downloads an image from a public URL and runs it through
13
+ the ResNet-50 fine tuned image-classification pipeline, returning the top predictions.
14
  """
15
  try:
16
  response = requests.get(image_url)
 
22
 
23
  # Format scores to remove scientific notation
24
  for r in results:
25
+ r["score"] = float(f"{r['score']:.2f}")
26
 
27
  return results
28
 
 
34
  inputs=gr.Textbox(lines=1, label="Image URL"),
35
  outputs="json",
36
  title="ResNet-50 Image Classifier",
37
+ description="Enter public image URL to get top predictions."
38
  )
39
 
40
  if __name__ == "__main__":