phxdev commited on
Commit
cf3eddf
ยท
verified ยท
1 Parent(s): b3bcfb4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -1
app.py CHANGED
@@ -967,7 +967,33 @@ def main():
967
 
968
  # Launch with modern styling and public sharing
969
  print("๐Ÿš€ Launching Real Creed AI with modern glassmorphism design...")
970
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
971
  demo.launch(
972
  ssr_mode=False,
973
  server_name="0.0.0.0",
 
967
 
968
  # Launch with modern styling and public sharing
969
  print("๐Ÿš€ Launching Real Creed AI with modern glassmorphism design...")
970
+ def _get_fallback_response(self) -> str:
971
+ """Fallback response when all generation methods fail"""
972
+ fallback_responses = [
973
+ "๐ŸŽธ *Creed stares blankly* You know what? Let me think about that one...",
974
+ "๐ŸŽธ That reminds me of something, but I can't quite remember what. Want to try asking again?",
975
+ "๐ŸŽธ *Creed looks confused* Sometimes my brain just... goes places. What were we talking about?",
976
+ "๐ŸŽธ You know, back in the '60s, we had a saying... actually, I forgot what it was. Try me again.",
977
+ "๐ŸŽธ *Creed scratches his head* I'm getting one of those feelings... like when you forget why you walked into a room.",
978
+ ]
979
+ import random
980
+ return random.choice(fallback_responses)
981
+
982
+ def _is_coherent(self, response: str) -> bool:
983
+ """Check if response is coherent enough"""
984
+ if not response or len(response.strip()) < 5:
985
+ return False
986
+
987
+ # Basic coherence checks
988
+ if response.count("Human:") > 2 or response.count("Assistant:") > 2:
989
+ return False
990
+
991
+ # Check for obvious model artifacts
992
+ artifacts = ["<|im_end|>", "<|im_start|>", "[INST]", "[/INST]"]
993
+ if any(artifact in response for artifact in artifacts):
994
+ return False
995
+
996
+ return True
997
  demo.launch(
998
  ssr_mode=False,
999
  server_name="0.0.0.0",