Spaces:
Runtime error
Runtime error
Update app.py
Browse files30 unmodified lines31323334353637383 unmodified lines424344454647484950513 unmodified lines555657585960616230 unmodified linesif m in models_vision:vision_available = Truepro_sub = Falsewhile True:try:InferenceClient(m, timeout=10, token=HUGGINGFACE_TOKEN).text_generation("Hi.", max_new_tokens=1)text_available = Trueexcept Exception as e:3 unmodified linesif e and "Rate limit reached" in str(e):print("Rate Limited, waiting 1 hour...")time.sleep(60*60)else:breakwhile True:try:InferenceClient(m, timeout=10).chat_completion(messages=[{'role': 'user', 'content': 'Hi.'}], max_tokens=1)chat_available = Trueexcept Exception as e:3 unmodified linesif e and "Rate limit reached" in str(e):print("Rate Limited, waiting 1 hour...")time.sleep(60*60)else:breakmodels_conclusion["Model"].append(m)models_conclusion["API"].append("Free" if chat_available or text_available else ("Pro Subscription" if pro_sub else "Not Responding"))models_conclusion["Chat Completion"].append("---" if (pro_sub or (not chat_available and not text_available)) else ("✓" if chat_available else "⌀"))30 unmodified lines313233343536373839403 unmodified lines44454647484950515253543 unmodified lines5859606162636430 unmodified linesif m in models_vision:vision_available = Truepro_sub = Falserun_text = Truewhile run_text:try:run_text = FalseInferenceClient(m, timeout=10, token=HUGGINGFACE_TOKEN).text_generation("Hi.", max_new_tokens=1)text_available = Trueexcept Exception as e:3 unmodified linesif e and "Rate limit reached" in str(e):print("Rate Limited, waiting 1 hour...")time.sleep(60*60)run_text = Truerun_chat = Truewhile run_chat:try:run_chat = FalseInferenceClient(m, timeout=10).chat_completion(messages=[{'role': 'user', 'content': 'Hi.'}], max_tokens=1)chat_available = Trueexcept Exception as e:3 unmodified linesif e and "Rate limit reached" in str(e):print("Rate Limited, waiting 1 hour...")time.sleep(60*60)run_chat = Truemodels_conclusion["Model"].append(m)models_conclusion["API"].append("Free" if chat_available or text_available else ("Pro Subscription" if pro_sub else "Not Responding"))models_conclusion["Chat Completion"].append("---" if (pro_sub or (not chat_available and not text_available)) else ("✓" if chat_available else "⌀"))
app.py+8-6