rajkumarrrk commited on
Commit
4b31515
·
verified ·
1 Parent(s): db3c2a3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -2,6 +2,7 @@ import gradio as gr
2
  from transformers import AutoModelForSequenceClassification, AutoTokenizer
3
  from jinja2 import Template
4
  import torch
 
5
 
6
 
7
  # load the judge
@@ -27,6 +28,7 @@ template = Template(
27
 
28
  def judge_reliability(document: str, conversation: str):
29
  with torch.no_grad():
 
30
  text = template.render(text=document, conversation=conversation)
31
  encoded = tokenizer([text], padding=True)
32
  input_ids = torch.tensor(encoded.input_ids).to(device)
 
2
  from transformers import AutoModelForSequenceClassification, AutoTokenizer
3
  from jinja2 import Template
4
  import torch
5
+ import json
6
 
7
 
8
  # load the judge
 
28
 
29
  def judge_reliability(document: str, conversation: str):
30
  with torch.no_grad():
31
+ conversation = json.loads(conversation)
32
  text = template.render(text=document, conversation=conversation)
33
  encoded = tokenizer([text], padding=True)
34
  input_ids = torch.tensor(encoded.input_ids).to(device)