| | import gradio as gr |
| |
|
| | import ctransformers |
| |
|
| | class Z(object): |
| | def __init__(self): |
| | self.llm = None |
| |
|
| | def init(self): |
| | pass |
| |
|
| | def greet(self, txt0, paramTemp): |
| | prompt0 = txt0 |
| |
|
| | |
| | |
| | |
| |
|
| | |
| | prompt00 = f'''{prompt0}''' |
| | |
| | response0 = llm(prompt00, max_new_tokens=198, temperature=paramTemp) |
| | |
| | return f'{response0}' |
| |
|
| | from ctransformers import AutoModelForCausalLM |
| |
|
| | |
| | |
| | |
| |
|
| | |
| |
|
| | |
| |
|
| |
|
| |
|
| | |
| | |
| | |
| | modelInfo = {'path':'NeoDim/starcoder-GGML', 'subPath':'starcoder-ggml-q8_0.bin', 'promptType':'raw', 'modelType':'starcoder'} |
| | llm = AutoModelForCausalLM.from_pretrained(modelInfo['path'], model_file=modelInfo['subPath'], model_type=modelInfo['modelType']) |
| |
|
| |
|
| |
|
| | z = Z() |
| | z.llm = llm |
| | z.modelInfo = modelInfo |
| | z.init() |
| |
|
| | def greet(prompt, temperature): |
| | global z |
| | return z.greet(prompt, temperature) |
| |
|
| | iface = gr.Interface(fn=greet, inputs=["text", gr.Slider(0.0, 1.0, value=0.41)], outputs="text") |
| | iface.launch() |