phate334 commited on
Commit
61b2179
1 Parent(s): 979a48f

[add] test run file

Browse files
Files changed (1) hide show
  1. app.py +12 -2
app.py CHANGED
@@ -1,11 +1,21 @@
1
  import os
 
2
 
3
  import gradio as gr
4
 
5
- def greet(name):
6
- return f"Hello, {name}!"
 
 
 
 
 
7
 
8
  iface = gr.Interface(fn=greet, inputs="text", outputs="text")
9
 
10
  if __name__ == "__main__":
 
 
 
 
11
  iface.launch()
 
1
  import os
2
+ from pathlib import Path
3
 
4
  import gradio as gr
5
 
6
+ GGUF_PARSER_VERSION = os.getenv("GGUF_PARSER_VERSION", "v0.12.0")
7
+ gguf_parser = Path("gguf-parser-linux-amd64")
8
+
9
+ def greet(tmp):
10
+ # Run the gguf-parser-go binary
11
+ gguf_parser_output = os.popen(f"./{gguf_parser} --version").read()
12
+ return f"{gguf_parser_output}"
13
 
14
  iface = gr.Interface(fn=greet, inputs="text", outputs="text")
15
 
16
  if __name__ == "__main__":
17
+ if not gguf_parser.exists():
18
+ gguf_parser_url = f"https://github.com/gpustack/gguf-parser-go/releases/download/{GGUF_PARSER_VERSION}/gguf-parser-linux-amd64"
19
+ os.system(f"wget {gguf_parser_url}")
20
+ os.system(f"chmod +x {gguf_parser}")
21
  iface.launch()