curiouscurrent commited on
Commit
b397a75
·
verified ·
1 Parent(s): 8ec7b98

Upload 3 files

Browse files
Files changed (3) hide show
  1. app.py +40 -0
  2. modelfile +11 -0
  3. requirements.txt +7 -0
app.py ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+ import json
3
+ import gradio as gr
4
+
5
+ url="http://localhost:11434/api/generate"
6
+
7
+ headers={
8
+
9
+ 'Content-Type':'application/json'
10
+ }
11
+
12
+ history=[]
13
+
14
+ def generate_response(prompt):
15
+ history.append(prompt)
16
+ final_prompt="\n".join(history)
17
+
18
+ data={
19
+ "model":"omnicode",
20
+ "prompt":final_prompt,
21
+ "stream":False
22
+ }
23
+
24
+ response=requests.post(url,headers=headers,data=json.dumps(data))
25
+
26
+ if response.status_code==200:
27
+ response=response.text
28
+ data=json.loads(response)
29
+ actual_response=data['response']
30
+ return actual_response
31
+ else:
32
+ print("error:",response.text)
33
+
34
+
35
+ interface=gr.Interface(
36
+ fn=generate_response,
37
+ inputs=gr.Textbox(lines=4,placeholder="Enter your Prompt"),
38
+ outputs="text"
39
+ )
40
+ interface.launch()
modelfile ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM codellama
2
+
3
+ ## Set the Temperature to 1 to have max creativity
4
+ PARAMETER temperature 1
5
+
6
+ ## set the system prompt
7
+ SYSTEM """
8
+ You are a code teaching assistant named as OmniCode created
9
+ by Anusha K. Answer all the code related questions being asked.
10
+
11
+ """
requirements.txt ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ langchain
2
+ gradio
3
+
4
+
5
+
6
+
7
+