Spaces:
Sleeping
Sleeping
hope last commit
Browse files- app.py +1 -1
- resource.py +27 -17
app.py
CHANGED
@@ -18,5 +18,5 @@ def main():
|
|
18 |
st.text_area("Bot Response:", value=response_gpt, height=100)
|
19 |
|
20 |
if __name__ == "__main__":
|
|
|
21 |
main()
|
22 |
-
|
|
|
18 |
st.text_area("Bot Response:", value=response_gpt, height=100)
|
19 |
|
20 |
if __name__ == "__main__":
|
21 |
+
imp()
|
22 |
main()
|
|
resource.py
CHANGED
@@ -4,39 +4,49 @@ from langchain.llms import GPT4All
|
|
4 |
from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
|
5 |
|
6 |
|
7 |
-
|
|
|
|
|
8 |
|
9 |
-
|
10 |
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
-
|
14 |
-
model=local_path,
|
15 |
-
callbacks=[StreamingStdOutCallbackHandler()]
|
16 |
-
)
|
17 |
|
|
|
18 |
|
|
|
19 |
|
20 |
-
llm_chain = LLMChain(prompt=prompt, llm=llm)
|
21 |
|
22 |
-
|
23 |
-
print("Error Loading Model Please Contact Admin",e)
|
24 |
|
25 |
|
|
|
26 |
|
|
|
27 |
|
|
|
28 |
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
|
|
33 |
|
34 |
-
Question: {question}
|
35 |
|
36 |
-
Answer:"""
|
37 |
|
|
|
38 |
|
39 |
-
|
|
|
40 |
|
41 |
|
42 |
|
|
|
4 |
from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
|
5 |
|
6 |
|
7 |
+
template = """
|
8 |
+
You are a friendly chatbot assistant you are going to evaluate a Github Repo i analysed all the repos and made a report
|
9 |
+
i'm gonna give a report you just refer the below table
|
10 |
|
11 |
+
Table:
|
12 |
|
13 |
+
score Rank Risk
|
14 |
+
1 - 5 A Low - Simple block
|
15 |
+
6 - 10 B Low - Well structured and stable block
|
16 |
+
11 - 20 C Moderate - Slightly complex block
|
17 |
+
21 - 30 D More than moderate - More complex block
|
18 |
+
31 - 40 E High - Complex block, alarming
|
19 |
+
41+ F Very high - Error-prone, unstable block
|
20 |
|
21 |
+
based on the score and rank you have to return only one most complex repo from report
|
|
|
|
|
|
|
22 |
|
23 |
+
Report: {report}
|
24 |
|
25 |
+
Answer:"""
|
26 |
|
|
|
27 |
|
28 |
+
prompt = PromptTemplate(template=template, input_variables=["report"])
|
|
|
29 |
|
30 |
|
31 |
+
def imp() :
|
32 |
|
33 |
+
try :
|
34 |
|
35 |
+
hf_hub_download(repo_id="dnato/ggml-gpt4all-j-v1.3-groovy.bin", filename="ggml-gpt4all-j-v1.3-groovy.bin", local_dir=".")
|
36 |
|
37 |
+
local_path=os.getcwd() + "/ggml-gpt4all-j-v1.3-groovy.bin"
|
38 |
+
|
39 |
+
llm = GPT4All(
|
40 |
+
model=local_path,
|
41 |
+
callbacks=[StreamingStdOutCallbackHandler()]
|
42 |
+
)
|
43 |
|
|
|
44 |
|
|
|
45 |
|
46 |
+
llm_chain = LLMChain(prompt=prompt, llm=llm)
|
47 |
|
48 |
+
except Exception as e:
|
49 |
+
print("Error Loading Model Please Contact Admin",e)
|
50 |
|
51 |
|
52 |
|