dingusagar commited on
Commit
2c6327d
·
verified ·
1 Parent(s): 9075b43

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -11
app.py CHANGED
@@ -5,7 +5,8 @@ from ollama import chat
5
  from ollama import ChatResponse
6
 
7
  # Default model
8
- OLLAMA_MODEL = "llama3.2:3b"
 
9
 
10
  # Load BERT MODEL
11
  from transformers import pipeline, DistilBertTokenizerFast
@@ -57,15 +58,14 @@ AITA : Am I the asshole? Usually posted in the question.
57
  YTA : You are the asshole in this situation.
58
  NTA : You are not the asshole in this situation.
59
 
60
- ### The task for you predict if most of the users would tag the given situation as YTA or NTA, give your personal opinion. Do not try to be nice, just give brutally honest and unbiased view. Base your decision entirely on the given text.
61
- Use second person terms like you in the explanation.
62
-
63
  ### The output format is as follows:
64
  "YTA" or "NTA", a short explanation.
65
 
66
-
67
  ### Situation : {question}
68
- ### Output :{expected_class}"""
69
 
70
  explain_only_prompt = f"""
71
  ### You know about the subreddit community r/AmItheAsshole. In this community people post their life situations and ask if they are the asshole or not.
@@ -74,12 +74,9 @@ AITA : Am I the asshole? Usually posted in the question.
74
  YTA : You are the asshole in this situation.
75
  NTA : You are not the asshole in this situation.
76
 
77
- ### The task for you explain why a particular situation was tagged as NTA or YTA by most users. I will give the situation as well as the NTA or YTA tag. just give your explanation for the label. Do not try to be nice, just give brutally honest and unbiased view. Base your decision entirely on the given text and the label tag.
78
  Use second person terms like you in the explanation.
79
 
80
- ### The output format is just the explanation for the label.
81
-
82
-
83
  ### Situation : {question}
84
  ### Label Tag : {expected_class}
85
  ### Explanation for {expected_class} :"""
@@ -101,7 +98,7 @@ Use second person terms like you in the explanation.
101
 
102
  def gradio_interface(prompt, selected_model):
103
  if selected_model == MODEL_CHOICE_LLAMA:
104
- response = ask_ollama(prompt, selected_model)
105
  elif selected_model == MODEL_CHOICE_BERT:
106
  response, confidence = ask_bert(prompt)
107
  response = f"{response} with confidence {confidence}"
 
5
  from ollama import ChatResponse
6
 
7
  # Default model
8
+ OLLAMA_MODEL = "llama3.2:3b-instruct-q3_K_M"
9
+ # OLLAMA_MODEL = "llama3.2:1b"
10
 
11
  # Load BERT MODEL
12
  from transformers import pipeline, DistilBertTokenizerFast
 
58
  YTA : You are the asshole in this situation.
59
  NTA : You are not the asshole in this situation.
60
 
61
+ ### The task for you label YTA or NTA for the given text. Give a short explanation for the label. Be brutally honest and unbiased. Base your explanation entirely on the given text only.
62
+
63
+ If the label is YTA, also explain what could the user have done better.
64
  ### The output format is as follows:
65
  "YTA" or "NTA", a short explanation.
66
 
 
67
  ### Situation : {question}
68
+ ### Response :"""
69
 
70
  explain_only_prompt = f"""
71
  ### You know about the subreddit community r/AmItheAsshole. In this community people post their life situations and ask if they are the asshole or not.
 
74
  YTA : You are the asshole in this situation.
75
  NTA : You are not the asshole in this situation.
76
 
77
+ ### The task for you explain why a particular situation was tagged as NTA or YTA by most users. I will give the situation as well as the NTA or YTA tag. just give your explanation for the label. Be nice but give a brutally honest and unbiased view. Base your explanation entirely on the given text and the label tag only. Do not assume anything extra.
78
  Use second person terms like you in the explanation.
79
 
 
 
 
80
  ### Situation : {question}
81
  ### Label Tag : {expected_class}
82
  ### Explanation for {expected_class} :"""
 
98
 
99
  def gradio_interface(prompt, selected_model):
100
  if selected_model == MODEL_CHOICE_LLAMA:
101
+ response = ask_ollama(prompt)
102
  elif selected_model == MODEL_CHOICE_BERT:
103
  response, confidence = ask_bert(prompt)
104
  response = f"{response} with confidence {confidence}"