jays009 commited on
Commit
334fb08
·
verified ·
1 Parent(s): f7b71ff

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -0
app.py CHANGED
@@ -82,10 +82,17 @@ def predict_from_url(url):
82
  def predict(image, url):
83
  try:
84
  print("Starting prediction...")
 
 
85
  if image:
 
86
  result = predict_from_image(image)
 
 
87
  elif url:
 
88
  result = predict_from_url(url)
 
89
  else:
90
  result = {"error": "No input provided. Please upload an image or provide a URL."}
91
 
@@ -98,6 +105,7 @@ def predict(image, url):
98
  print(f"Error in prediction function: {e}")
99
  return {"error": str(e)}
100
 
 
101
  # Function to retrieve result by event_id
102
  def get_result(event_id):
103
  try:
 
82
  def predict(image, url):
83
  try:
84
  print("Starting prediction...")
85
+
86
+ # Check if image is provided (direct upload)
87
  if image:
88
+ print("Processing uploaded image...")
89
  result = predict_from_image(image)
90
+
91
+ # Check if URL is provided
92
  elif url:
93
+ print("Processing image from URL...")
94
  result = predict_from_url(url)
95
+
96
  else:
97
  result = {"error": "No input provided. Please upload an image or provide a URL."}
98
 
 
105
  print(f"Error in prediction function: {e}")
106
  return {"error": str(e)}
107
 
108
+
109
  # Function to retrieve result by event_id
110
  def get_result(event_id):
111
  try: