mostafaamiri commited on
Commit
a8a13f3
1 Parent(s): 95c389b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -58
app.py CHANGED
@@ -6,30 +6,14 @@ import re
6
  import os
7
 
8
 
9
- # MODEL_PATH = "persian_llama_7b.Q8_K_M.gguf"
10
- # TEMPRATURE = 0.3
11
- # MAX_TOKENS = 800
12
- # for k,v in os.environ.items():
13
- # if(k=="MODEL_PATH"):
14
- # MODEL_PATH = v
15
- # if(k== "TEMPRATURE"):
16
- # TEMPRATURE = v
17
- # if(k == "MAX_TOKENS"):
18
- # MAX_TOKENS = v
19
 
20
- # print("model: "+MODEL_PATH)
21
- # print("temp: "+TEMPRATURE)
22
- # print("max_tokens: "+MAX_TOKENS)
23
  n_gpu_layers = 40 # Change this value based on your model and your GPU VRAM pool.
24
  n_batch = 512 # Should be between 1 and n_ctx, consider the amount of VRAM in your GPU.
25
  n_ctx=2048
26
 
27
  callback_manager = CallbackManager([StreamingStdOutCallbackHandler()])
28
  path = "mostafaamiri/persian-llama-7b-GGUF-Q4/persian_llama_7b.Q8_K_M.gguf"
29
- # persian_llama_7b.Q4_K_M.gguf
30
- # persian_llama_7b.Q8_K_M.gguf
31
- # persian_llama_7b.f32.gguf
32
- # Make sure the model path is correct for your system!
33
  llm = LlamaCpp(
34
  model_path= path,
35
  n_gpu_layers=n_gpu_layers, n_batch=n_batch,
@@ -52,31 +36,7 @@ def generate_output(text):
52
  def clear():
53
  return "", ""
54
 
55
- # def like_log(input, output):
56
- # with open("like_log.txt", "a") as f:
57
- # f.write("{\"model\": \""+MODEL_PATH+"\",\n\"temprature\": "+TEMPRATURE+",\n\"input\": \""+input+"\",\n\"output\": \""+output+"\"},\n")
58
-
59
- # def dislike_log(input, output):
60
- # with open("dislike_log.txt", "a") as f:
61
- # f.write("{\"model\": \""+MODEL_PATH+"\",\n\"temprature\": "+TEMPRATURE+",\n\"input\": \""+input+"\",\n\"output\": \""+output+"\"},\n")
62
-
63
-
64
  with gr.Blocks(theme=gr.themes.Soft()) as demo:
65
- gr.Markdown(
66
- dal_image+
67
- """
68
- <br>
69
- <div dir="rtl">
70
- <h1>
71
- مدل هوش مصنوعی دال
72
- </h1>
73
- <p dir="rtl">
74
- تماس با ما با
75
- <br/>
76
- info[@]aidal.ir
77
- </p>
78
- </div>
79
- """)
80
  with gr.Row():
81
  inputs=gr.Textbox(label="ورودی",placeholder="سوال خود را وارد کنید",rtl=True)
82
 
@@ -89,22 +49,6 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
89
  inputs= [inputs],
90
  outputs= [outputs])
91
  clear_btn.click(fn=clear, inputs=[], outputs=[inputs, outputs])
92
- # with gr.Row():
93
- # like_btn= gr.Button("👍🏾")
94
- # dislike_btn= gr.Button("👎🏾")
95
- # like_btn.click(fn=like_log,
96
- # inputs= [inputs, outputs],
97
- # outputs=[]
98
- # )
99
- # dislike_btn.click(fn=dislike_log,
100
- # inputs= [inputs, outputs],
101
- # outputs=[]
102
- )
103
- # gr_interface = gr.Interface(fn=generate_output,
104
- # inputs=gr.Textbox(label="ورودی",placeholder="سوال خود را وارد کنید",rtl=True),
105
- # outputs=gr.Textbox(label="خروجی",rtl=True),
106
- # live=False,
107
- # flagging_options=["👍🏾","👎🏾"],
108
- # concurrency_limit=5)
109
 
110
  demo.launch(server_name='0.0.0.0',share=True)
 
6
  import os
7
 
8
 
 
 
 
 
 
 
 
 
 
 
9
 
 
 
 
10
  n_gpu_layers = 40 # Change this value based on your model and your GPU VRAM pool.
11
  n_batch = 512 # Should be between 1 and n_ctx, consider the amount of VRAM in your GPU.
12
  n_ctx=2048
13
 
14
  callback_manager = CallbackManager([StreamingStdOutCallbackHandler()])
15
  path = "mostafaamiri/persian-llama-7b-GGUF-Q4/persian_llama_7b.Q8_K_M.gguf"
16
+
 
 
 
17
  llm = LlamaCpp(
18
  model_path= path,
19
  n_gpu_layers=n_gpu_layers, n_batch=n_batch,
 
36
  def clear():
37
  return "", ""
38
 
 
 
 
 
 
 
 
 
 
39
  with gr.Blocks(theme=gr.themes.Soft()) as demo:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  with gr.Row():
41
  inputs=gr.Textbox(label="ورودی",placeholder="سوال خود را وارد کنید",rtl=True)
42
 
 
49
  inputs= [inputs],
50
  outputs= [outputs])
51
  clear_btn.click(fn=clear, inputs=[], outputs=[inputs, outputs])
52
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
 
54
  demo.launch(server_name='0.0.0.0',share=True)