-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
34 lines (24 loc) · 867 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import requests
url = "http://localhost:11434/api/generate"
# data = {
# "model": "llama3",
# "prompt":"Why is the sky blue?",
# "stream": False
# }
#
# response = requests.post(url, json=data)
#
# result = response.json()
# print(result['response'])
with open('qb.txt', 'r') as file:
for line in file:
print(line)
data = {
"model": "llama3",
"prompt": f"you are a student appearing for an university level proffesional skills for enginners exam tommorow. This is the question: '{line}' write the best answer to this question. Write exactly like you would in the exam",
"stream": False
}
response = requests.post(url, json=data)
result = response.json()
with open('qb_answers.txt', 'a') as file:
file.write(result['response'] +'\n'+ 'End of a' +'\n')