Spaces:
Sleeping
Sleeping
Create resource.py
Browse files- resource.py +31 -0
resource.py
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from langchain import PromptTemplate, LLMChain
|
2 |
+
from huggingface_hub import hf_hub_download
|
3 |
+
from langchain.llms import GPT4All
|
4 |
+
from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
|
5 |
+
import os
|
6 |
+
|
7 |
+
|
8 |
+
template ="""
|
9 |
+
You are a friendly chatbot assistant you are going to evaluate a Github Repo i analysed all the repos and made a report
|
10 |
+
i'm gonna give a report you just refer the below table
|
11 |
+
Table:
|
12 |
+
score Risk
|
13 |
+
1 - 5 Low - Simple block
|
14 |
+
6 - 10 Low - Well structured and stable block
|
15 |
+
11 - 20 Moderate - Slightly complex block
|
16 |
+
21 - 30 More than moderate - More complex block
|
17 |
+
31 - 40 High - Complex block, alarming
|
18 |
+
41+ Very high - Error-prone, unstable block
|
19 |
+
based on the score and you have to return only one most complex repo which has more score from report
|
20 |
+
when the score is high thats the complex repo and
|
21 |
+
if all the repos are at the same score choose randomly one
|
22 |
+
Report: {question}
|
23 |
+
Answer:"""
|
24 |
+
|
25 |
+
|
26 |
+
prompt = PromptTemplate(template=template, input_variables=["question"])
|
27 |
+
|
28 |
+
#hf_hub_download(repo_id="dnato/ggml-gpt4all-j-v1.3-groovy.bin", filename="ggml-gpt4all-j-v1.3-groovy.bin", local_dir="/code")
|
29 |
+
local_path= os.getcwd() + "/ggml-gpt4all-j-v1.3-groovy.bin"
|
30 |
+
llm = GPT4All(model=local_path,callbacks=[StreamingStdOutCallbackHandler()] )
|
31 |
+
llm_chain = LLMChain(prompt=prompt, llm=llm)
|