oberbics commited on
Commit
a938752
·
verified ·
1 Parent(s): 8aad60f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -3
app.py CHANGED
@@ -66,6 +66,7 @@ class SafeGeocoder:
66
  return None
67
 
68
  # Function to just load the model
 
69
  def load_model():
70
  try:
71
  # Send a minimal request just to trigger model loading
@@ -85,10 +86,19 @@ def load_model():
85
  estimated_time = response_json.get("estimated_time", "unknown")
86
  return f"⏳ Modell lädt... (ca. {int(float(estimated_time)) if isinstance(estimated_time, (int, float, str)) else 'unbekannt'} Sekunden)"
87
 
88
- if response.status_code != 200:
89
- return f"❌ API Fehler: {response.status_code}"
 
 
 
 
 
 
 
 
 
 
90
 
91
- return "✅ Modell erfolgreich geladen! Sie können jetzt mit der Extraktion beginnen."
92
  except Exception as e:
93
  return f"❌ Fehler: {str(e)}"
94
 
 
66
  return None
67
 
68
  # Function to just load the model
69
+ # Function that truly tests if the model is loaded
70
  def load_model():
71
  try:
72
  # Send a minimal request just to trigger model loading
 
86
  estimated_time = response_json.get("estimated_time", "unknown")
87
  return f"⏳ Modell lädt... (ca. {int(float(estimated_time)) if isinstance(estimated_time, (int, float, str)) else 'unbekannt'} Sekunden)"
88
 
89
+ # The key difference: Actually check if we got valid output
90
+ if response.status_code == 200:
91
+ # Make sure we got a valid response not just HTTP 200
92
+ result = response.json()
93
+ if isinstance(result, list) and len(result) > 0:
94
+ # Try to verify we got real model output
95
+ result_text = result[0].get("generated_text", "")
96
+ if len(result_text) > 10: # Some basic validation
97
+ return "✅ Modell erfolgreich geladen! Sie können jetzt mit der Extraktion beginnen."
98
+
99
+ # If we get here, something is still wrong
100
+ return "⚠️ Modell scheint nicht vollständig geladen zu sein. Bitte versuchen Sie es erneut."
101
 
 
102
  except Exception as e:
103
  return f"❌ Fehler: {str(e)}"
104