zeyadahmedd commited on
Commit
b884c59
โ€ข
1 Parent(s): 291fd23

Update test/new.py

Browse files
Files changed (1) hide show
  1. test/new.py +7 -19
test/new.py CHANGED
@@ -1,20 +1,9 @@
1
  from gradio_client import Client
2
- import time
3
- # prompt="""
4
- # ู…ู† ู‡ูŠ ุณู„ู…ูŠุŸ
5
- # """
6
- # #who is salma
7
- # en_Pr="""
8
- #
9
- # who is salma
10
- #
11
- # """
12
- # context=["ููŠ ุณู„ู…ูŠ.pdf:ุณู„ู…ูŠ ู‡ูŠ ู…ู‡ู†ุฏุณุฉ","ููŠ ุณู„ู…ูŠ.pdf:ุณู„ู…ูŠ ู‡ูŠ ุทุงู„ุจุฉ ููŠ ูƒู„ูŠุฉ ุญุงุณุจุงุช ูˆ ู…ุนู„ูˆู…ุงุช","ููŠ ุงุฑูƒู„ูŠุงุจ.pdf:ุณู„ู…ูŠ ู‡ูŠ ู…ูˆุถูุฉ ููŠ ู‚ุณู… ุงู„ุฐูƒุงุก ุงู„ุงุตุทู†ุงุนูŠ"]
13
- # en_Cont=['in salma_ahmed.pdf: salma is a computer developer', 'in salmaaaaa3333.pdf: salma is an employee in arkleap ', 'in salmaaaaa3333.pdf: salma works from 9 to 5 ', 'in italy_emploee.pdf: salma is a agent who works as a spy ', 'in zolompa7.pdf:']
14
- old=time.time()
15
- system_prompt = """You are a helpful assistant, you will use the provided context to answer user questions.
16
- Read the given context before answering questions and think step by step. If you can not answer a user question based on
17
- the provided context, inform the user. Do not use any other information for answering user. Provide a detailed answer to the question."""
18
  B_INST, E_INST = "[INST]", "[/INST]"
19
  B_SYS, E_SYS = "<<SYS>>\n", "\n<</SYS>>\n\n"
20
  SYSTEM_PROMPT = B_SYS + system_prompt + E_SYS
@@ -31,7 +20,7 @@ context:"{}"
31
  answer:
32
  """.format(query, context), # str in 'parameter_7' Textbox component
33
  prompt_template , # str in 'Optional system prompt' Textbox component
34
- 2048, # int | float (numeric value between 0 and 4096) in 'Max new tokens' Slider componentูˆ
35
  0.1,
36
  0.05,
37
  1, # int | float (numeric value between 0.0 and 1) in 'Top-p (nucleus sampling)' Slider component
@@ -39,5 +28,4 @@ answer:
39
  api_name="/chat"
40
  )
41
  # print(time.time() - old, "sec")
42
- return result
43
-
 
1
  from gradio_client import Client
2
+ system_prompt = """You are a helpful assistant, you will use the provided context only to answer user questions.
3
+ Read the given context before answering questions and think step by step. you could get context or question in other language than english.
4
+ Answer only if the question related to the contexts, don't use your own data ..if the question isn't related to the context ,respond with "sorry..no provided context for this question".
5
+ If you can not answer a user question based on provided context only , inform the user.
6
+ Do not use any other information for answering user. Provide a detailed answer to the question."""
 
 
 
 
 
 
 
 
 
 
 
7
  B_INST, E_INST = "[INST]", "[/INST]"
8
  B_SYS, E_SYS = "<<SYS>>\n", "\n<</SYS>>\n\n"
9
  SYSTEM_PROMPT = B_SYS + system_prompt + E_SYS
 
20
  answer:
21
  """.format(query, context), # str in 'parameter_7' Textbox component
22
  prompt_template , # str in 'Optional system prompt' Textbox component
23
+ 4096, # int | float (numeric value between 0 and 4096) in 'Max new tokens' Slider componentูˆ
24
  0.1,
25
  0.05,
26
  1, # int | float (numeric value between 0.0 and 1) in 'Top-p (nucleus sampling)' Slider component
 
28
  api_name="/chat"
29
  )
30
  # print(time.time() - old, "sec")
31
+ return result