Update app.py
Browse files
app.py
CHANGED
@@ -8,19 +8,28 @@ llm = Llama(
|
|
8 |
)
|
9 |
|
10 |
def chat(message, history):
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
response = llm(
|
12 |
-
|
13 |
-
max_tokens=
|
14 |
-
temperature=0.
|
15 |
-
stop=["USER:",
|
|
|
|
|
16 |
)
|
|
|
17 |
return response['choices'][0]['text']
|
18 |
|
19 |
demo = gr.ChatInterface(
|
20 |
fn=chat,
|
21 |
-
title="YugoGPT Chat"
|
|
|
22 |
)
|
23 |
|
24 |
if __name__ == "__main__":
|
25 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|
26 |
-
|
|
|
8 |
)
|
9 |
|
10 |
def chat(message, history):
|
11 |
+
# Enhanced prompt template for more detailed responses
|
12 |
+
prompt = f"""USER: {message}
|
13 |
+
ASSISTANT: Let me provide you with a comprehensive and thoughtful response.
|
14 |
+
|
15 |
+
"""
|
16 |
+
|
17 |
response = llm(
|
18 |
+
prompt,
|
19 |
+
max_tokens=1024, # Increased token limit
|
20 |
+
temperature=0.8, # Slightly increased creativity
|
21 |
+
stop=["USER:"], # Only stop at new user input
|
22 |
+
repeat_penalty=1.2, # Reduce repetition
|
23 |
+
top_p=0.95 # Maintain focus while allowing creativity
|
24 |
)
|
25 |
+
|
26 |
return response['choices'][0]['text']
|
27 |
|
28 |
demo = gr.ChatInterface(
|
29 |
fn=chat,
|
30 |
+
title="YugoGPT Chat",
|
31 |
+
description="Ask me anything - I'll provide detailed and thoughtful responses."
|
32 |
)
|
33 |
|
34 |
if __name__ == "__main__":
|
35 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|
|