panditamey
commited on
Commit
•
4c45c64
1
Parent(s):
51cc83f
Update app.py
Browse files
app.py
CHANGED
@@ -15,6 +15,20 @@ from flask_cors import CORS, cross_origin
|
|
15 |
|
16 |
import wikipedia as wiki
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
app = Flask(__name__)
|
20 |
|
@@ -53,7 +67,9 @@ def upload_image():
|
|
53 |
index = predictions.index(max_num)
|
54 |
print(classes[index])
|
55 |
os.remove(str(imag.filename))
|
56 |
-
result
|
|
|
|
|
57 |
response = jsonify(output=classes[index],desc = result)
|
58 |
|
59 |
# response.headers.add('Access-Control-Allow-Origin', '*')
|
|
|
15 |
|
16 |
import wikipedia as wiki
|
17 |
|
18 |
+
from huggingface_hub import hf_hub_download
|
19 |
+
from pyllamacpp.model import Model
|
20 |
+
|
21 |
+
#Download the model
|
22 |
+
hf_hub_download(repo_id="LLukas22/gpt4all-lora-quantized-ggjt", filename="ggjt-model.bin", local_dir=".")
|
23 |
+
|
24 |
+
#Load the model
|
25 |
+
model = Model(ggml_model="ggjt-model.bin", n_ctx=2000)
|
26 |
+
|
27 |
+
#Generate
|
28 |
+
# prompt="User: How are you doing?\nBot:"
|
29 |
+
|
30 |
+
# result=model.generate(prompt,n_predict=50)
|
31 |
+
|
32 |
|
33 |
app = Flask(__name__)
|
34 |
|
|
|
67 |
index = predictions.index(max_num)
|
68 |
print(classes[index])
|
69 |
os.remove(str(imag.filename))
|
70 |
+
result=model.generate("Information and Precaution Instructions about " +str(classes[index] +"is",n_predict=50)
|
71 |
+
|
72 |
+
# result = wiki.summary(str(classes[index]))
|
73 |
response = jsonify(output=classes[index],desc = result)
|
74 |
|
75 |
# response.headers.add('Access-Control-Allow-Origin', '*')
|