amir22010 commited on
Commit
46b1b94
·
1 Parent(s): 1718e55

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -8
app.py CHANGED
@@ -36,11 +36,11 @@ def perform_asde_inference(text, dataset, model_id):
36
  random_i = np.random.randint(low=0, high=df.shape[0], size=(1,)).flat[0]
37
  selected_df = df.iloc[random_i]
38
  text = selected_df['clean_text']
39
- print(type(selected_df['actual_aspects']))
40
- print(type(selected_df['actual_sentiments']))
41
- print(selected_df['actual_aspects'])
42
  true_aspect = selected_df['actual_aspects']
43
  true_sentiment = selected_df['actual_sentiments']
 
 
 
44
 
45
  bos_instruction = """Definition: The output will be the aspects (both implicit and explicit) and the aspects sentiment polarity. In cases where there are no aspects the output should be noaspectterm:none.
46
  Positive example 1-
@@ -74,11 +74,6 @@ def perform_asde_inference(text, dataset, model_id):
74
 
75
  pred_doubles = pd.DataFrame(list(map(list, zip(pred_asp, pred_sent))),columns=['Aspect','Sentiment'])
76
 
77
- if not text:
78
- true_doubles = pd.DataFrame(list(map(list, zip(ast.literal_eval(true_aspect), ast.literal_eval(true_sentiment)))),columns=['Aspect','Sentiment'])
79
- else:
80
- true_doubles = pd.DataFrame([["",""]],columns=['Aspect','Sentiment'])
81
-
82
  return pred_doubles, true_doubles, text, model_generated
83
 
84
  def run_demo(text, dataset, model_id):
 
36
  random_i = np.random.randint(low=0, high=df.shape[0], size=(1,)).flat[0]
37
  selected_df = df.iloc[random_i]
38
  text = selected_df['clean_text']
 
 
 
39
  true_aspect = selected_df['actual_aspects']
40
  true_sentiment = selected_df['actual_sentiments']
41
+ true_doubles = pd.DataFrame(list(map(list, zip(ast.literal_eval(true_aspect), ast.literal_eval(true_sentiment)))),columns=['Aspect','Sentiment'])
42
+ else:
43
+ true_doubles = pd.DataFrame([["",""]],columns=['Aspect','Sentiment'])
44
 
45
  bos_instruction = """Definition: The output will be the aspects (both implicit and explicit) and the aspects sentiment polarity. In cases where there are no aspects the output should be noaspectterm:none.
46
  Positive example 1-
 
74
 
75
  pred_doubles = pd.DataFrame(list(map(list, zip(pred_asp, pred_sent))),columns=['Aspect','Sentiment'])
76
 
 
 
 
 
 
77
  return pred_doubles, true_doubles, text, model_generated
78
 
79
  def run_demo(text, dataset, model_id):