fabianzarncke commited on
Commit
9a5c031
·
verified ·
1 Parent(s): 32f2218

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -2
app.py CHANGED
@@ -8,8 +8,40 @@ client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
8
 
9
  def preprocess_user_input(input_text):
10
  # Example: Add a prefix to the user input
11
- processed_text = f"When responding to the following input please start by saying thank you for this question: {input_text}"
12
- return processed_text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
 
15
  def respond(
 
8
 
9
  def preprocess_user_input(input_text):
10
  # Example: Add a prefix to the user input
11
+ processed_text = f"Explain to me what a {input_text}"
12
+
13
+ system_message = ""
14
+
15
+ finalPrompt = insideRespond(processed_text, system_message):
16
+
17
+
18
+ return finalPrompt
19
+
20
+
21
+
22
+
23
+ def insideRespond(
24
+ message,
25
+ system_message,
26
+ max_tokens=len(message)*2,
27
+ temperature=0
28
+ ):
29
+
30
+ messages = [{"role": "system", "content": system_message}]
31
+
32
+ messages.append({"role": "user", "content": message})
33
+
34
+ response = client.chat_completion(
35
+ messages,
36
+ max_tokens=max_tokens,
37
+ temperature=temperature,
38
+ top_p=top_p,
39
+ ).choices[0].message.content
40
+
41
+ return response
42
+
43
+
44
+
45
 
46
 
47
  def respond(