thuyentruong commited on
Commit
fbff7a3
1 Parent(s): 18ece8c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -10
app.py CHANGED
@@ -34,18 +34,18 @@ def get_sentiment_from_llm(review_text):
34
  segments=segments+split_conj(sen)
35
  ls_outputs=[]
36
 
 
37
  print(segments)
38
  for seg in segments:
39
- if len(seg)>=5:
40
- input = make_prompt(seg)
41
- inputs = tokenizer(input, return_tensors='pt')
42
- output = tokenizer.decode(
43
- model.generate(
44
- inputs["input_ids"],
45
- max_new_tokens=100,
46
- )[0],
47
- skip_special_tokens=True)
48
- ls_outputs.append("\n".join(output.split('PPrint ')))
49
  return "\n".join(ls_outputs)
50
  demo = gr.Blocks()
51
  sentiment_extr = gr.Interface(
 
34
  segments=segments+split_conj(sen)
35
  ls_outputs=[]
36
 
37
+ segments= [x if len(x)>=5 for x in segments]
38
  print(segments)
39
  for seg in segments:
40
+ input = make_prompt(seg)
41
+ inputs = tokenizer(input, return_tensors='pt')
42
+ output = tokenizer.decode(
43
+ model.generate(
44
+ inputs["input_ids"],
45
+ max_new_tokens=100,
46
+ )[0],
47
+ skip_special_tokens=True)
48
+ ls_outputs.append("\n".join(output.split('PPrint ')))
 
49
  return "\n".join(ls_outputs)
50
  demo = gr.Blocks()
51
  sentiment_extr = gr.Interface(