Alpaca69B commited on
Commit
37420be
1 Parent(s): 9a78c83

Update README.md

Browse files

adjusted code to run the model

Files changed (1) hide show
  1. README.md +29 -1
README.md CHANGED
@@ -84,10 +84,38 @@ def process_user_prompt(input_sentence):
84
  return result_dict
85
 
86
  def process_output(output):
87
- # ... (provided code for processing output)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
 
89
  output = process_user_prompt('the first thing that attracts attention is the warm reception and the smiling receptionists.')
90
  print(output)
 
91
  ```
92
 
93
  ## Fine-Tuning Details
 
84
  return result_dict
85
 
86
  def process_output(output):
87
+ result_dict = {}
88
+
89
+ # Extract user_prompt
90
+ user_prompt_start = output.find("### Human:")
91
+ user_prompt_end = output.find("aspect: ") + len("aspect: ")
92
+ result_dict['user_prompt'] = output[user_prompt_start:user_prompt_end].strip()
93
+
94
+ # Extract cleared_generated_output
95
+ cleared_output_end = output.find(")")
96
+ result_dict['cleared_generated_output'] = output[:cleared_output_end+1].strip()
97
+
98
+ # Extract review
99
+ human_start = output.find("Human:") + len("Human:")
100
+ assistant_start = output.find("### Assistant:")
101
+ result_dict['review'] = output[human_start:assistant_start].strip()
102
+
103
+ # Extract aspect and sentiment
104
+ aspect_start = output.find("aspect: ") + len("aspect: ")
105
+ sentiment_start = output.find("sentiment: ")
106
+ aspect_text = output[aspect_start:sentiment_start].strip()
107
+ result_dict['aspect'] = aspect_text
108
+
109
+ sentiment_end = output[sentiment_start:].find(")") + sentiment_start
110
+ sentiment_text = output[sentiment_start+len("sentiment:"):sentiment_end].strip()
111
+ result_dict['sentiment'] = sentiment_text
112
+
113
+ return result_dict
114
+
115
 
116
  output = process_user_prompt('the first thing that attracts attention is the warm reception and the smiling receptionists.')
117
  print(output)
118
+
119
  ```
120
 
121
  ## Fine-Tuning Details