yasu-oh commited on
Commit
fd1928a
·
1 Parent(s): 24d5f9f
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -1,5 +1,6 @@
1
  import gradio as gr
2
  import requests
 
3
  from typing import Optional
4
 
5
 
@@ -48,8 +49,15 @@ def is_architecture_supported(architecture: str) -> Optional[bool]:
48
  response = requests.get(LLAMA_CPP_SOURCE)
49
  response.raise_for_status()
50
  content = response.text
51
- models = [line for line in content.splitlines() if "@Model.register" in line]
52
- return any(architecture in entry for entry in models)
 
 
 
 
 
 
 
53
  except:
54
  return None
55
 
 
1
  import gradio as gr
2
  import requests
3
+ import re
4
  from typing import Optional
5
 
6
 
 
49
  response = requests.get(LLAMA_CPP_SOURCE)
50
  response.raise_for_status()
51
  content = response.text
52
+ pattern = r"@ModelBase\.register\((.*?)\)"
53
+ matches = re.findall(pattern, content, re.DOTALL)
54
+ model_names = [
55
+ name.strip()
56
+ for match in matches
57
+ for name in match.replace('\n', '').replace('"', '').split(',')
58
+ if name.strip()
59
+ ]
60
+ return any(architecture in entry for entry in model_names)
61
  except:
62
  return None
63