cigol123 commited on
Commit
02622b1
·
verified ·
1 Parent(s): a268e29

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -6
app.py CHANGED
@@ -21,11 +21,12 @@ def chat(message, history):
21
 
22
  PRAVILA RADA:
23
  - Dajem precizne i korisne informacije
24
- - Fokusiram se na ono što znam i mogu da objasnim
25
  - Koristim jasan i precizan jezik
26
  - Primarno komuniciram na srpskom jeziku
27
  - Odgovaram direktno i pozitivno
28
- - Fokusiram se na rešenja i mogućnosti"""
 
29
 
30
  chat_history = format_chat_history(history)
31
 
@@ -52,15 +53,19 @@ USER: {message}
52
  for chunk in response:
53
  if chunk and chunk['choices'][0]['text']:
54
  text = chunk['choices'][0]['text']
55
- # Remove "ASSISTANT:" if it appears in the response
56
  text = text.replace("ASSISTANT:", "").strip()
 
 
 
 
57
  partial_message += text
58
- yield partial_message
59
 
60
  demo = gr.ChatInterface(
61
  fn=chat,
62
- title="YugoGPT Stručni Asistent u pokušaju. PAŽNJA!!! Zna da halucinira t.j. da laže!!!",
63
- description="Precizan izvor informacija i stručne pomoći",
64
  examples=[
65
  "Koji su osnovni principi relacionih baza podataka?",
66
  "Objasnite kako funkcioniše HTTP protokol",
 
21
 
22
  PRAVILA RADA:
23
  - Dajem precizne i korisne informacije
24
+ - Odgovaram sa sigurnošću o temama koje poznajem
25
  - Koristim jasan i precizan jezik
26
  - Primarno komuniciram na srpskom jeziku
27
  - Odgovaram direktno i pozitivno
28
+ - Fokusiram se na rešenja i mogućnosti
29
+ - Uvek koristim pravilnu interpunkciju i razmake između reči"""
30
 
31
  chat_history = format_chat_history(history)
32
 
 
53
  for chunk in response:
54
  if chunk and chunk['choices'][0]['text']:
55
  text = chunk['choices'][0]['text']
56
+ # Clean up the text
57
  text = text.replace("ASSISTANT:", "").strip()
58
+ # Ensure proper spacing after punctuation
59
+ text = text.replace(".", ". ").replace(",", ", ").replace("!", "! ").replace("?", "? ")
60
+ # Remove double spaces
61
+ text = " ".join(text.split())
62
  partial_message += text
63
+ yield partial_message.strip()
64
 
65
  demo = gr.ChatInterface(
66
  fn=chat,
67
+ title="YugoGPT Stručni Asistent",
68
+ description="Precizan izvor informacija i stručne pomoći, PAŽNJA!!! ZNA DA HALUCINIRA I ZATO PONEKAD LAŽE!!!",
69
  examples=[
70
  "Koji su osnovni principi relacionih baza podataka?",
71
  "Objasnite kako funkcioniše HTTP protokol",