Update app.py
Browse files
app.py
CHANGED
@@ -81,24 +81,6 @@ def respond(
|
|
81 |
prompt += f"{role}{hmessage['content']}\n<|end|>"
|
82 |
prompt += f"<|assistant|>"
|
83 |
|
84 |
-
"""
|
85 |
-
# Generate the response
|
86 |
-
response_output = generator(
|
87 |
-
prompt,
|
88 |
-
generation_config=generator_conf,
|
89 |
-
max_new_tokens=max_tokens,
|
90 |
-
do_sample=True,
|
91 |
-
top_p=top_p,
|
92 |
-
repetition_penalty=1.2,
|
93 |
-
temperature=temperature
|
94 |
-
)
|
95 |
-
|
96 |
-
generated_text = response_output[0]['generated_text']
|
97 |
-
|
98 |
-
# Extract the assistant's response
|
99 |
-
result = generated_text[len(prompt):]
|
100 |
-
# result = prompt +':'+result
|
101 |
-
"""
|
102 |
tokens_cnt = 0
|
103 |
tokens_inc = 3
|
104 |
last_token_len = 1
|
@@ -135,7 +117,7 @@ status_text = \
|
|
135 |
f"Current CPU usage is {cpu_usage:.2f}% .'" + \
|
136 |
f"You may ask questions such as 'What is biology?' or 'What is the human body?'"
|
137 |
|
138 |
-
"""
|
139 |
demo = gr.ChatInterface(
|
140 |
respond,
|
141 |
additional_inputs=[
|
@@ -172,7 +154,7 @@ with gr.Blocks() as demo:
|
|
172 |
),
|
173 |
],
|
174 |
)
|
175 |
-
|
176 |
|
177 |
if __name__ == "__main__":
|
178 |
demo.launch()
|
|
|
81 |
prompt += f"{role}{hmessage['content']}\n<|end|>"
|
82 |
prompt += f"<|assistant|>"
|
83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
tokens_cnt = 0
|
85 |
tokens_inc = 3
|
86 |
last_token_len = 1
|
|
|
117 |
f"Current CPU usage is {cpu_usage:.2f}% .'" + \
|
118 |
f"You may ask questions such as 'What is biology?' or 'What is the human body?'"
|
119 |
|
120 |
+
# """
|
121 |
demo = gr.ChatInterface(
|
122 |
respond,
|
123 |
additional_inputs=[
|
|
|
154 |
),
|
155 |
],
|
156 |
)
|
157 |
+
"""
|
158 |
|
159 |
if __name__ == "__main__":
|
160 |
demo.launch()
|