wagnercosta commited on
Commit
98ccbed
·
verified ·
1 Parent(s): 35e452a

Fix medium phi3

Browse files
Files changed (2) hide show
  1. app.py +2 -4
  2. phi3_instruct_graph.py +1 -2
app.py CHANGED
@@ -80,7 +80,6 @@ def create_custom_entity_viz(data, full_text):
80
  start = dataentity["start"]
81
  end = dataentity["end"]
82
 
83
- print("entity spans:", entity_spans)
84
  if start < len(doc) and end <= len(doc):
85
  span = Span(doc, start, end, label=node["type"])
86
 
@@ -89,8 +88,8 @@ def create_custom_entity_viz(data, full_text):
89
  if node["type"] not in colors:
90
  colors[node["type"]] = get_random_light_color()
91
 
92
- for span in spans:
93
- print(f"Span: {span.text}, Label: {span.label_}")
94
 
95
  doc.set_ents(spans, default="unmodified")
96
  doc.spans["sc"] = spans
@@ -160,7 +159,6 @@ def process_and_visualize(text, model):
160
  raise gr.Error("Text and model must be provided.")
161
  json_data = extract(text, model)
162
  # json_data = json_example
163
- print(json_data)
164
  entities_viz = create_custom_entity_viz(json_data, text)
165
 
166
  graph_html = create_graph(json_data)
 
80
  start = dataentity["start"]
81
  end = dataentity["end"]
82
 
 
83
  if start < len(doc) and end <= len(doc):
84
  span = Span(doc, start, end, label=node["type"])
85
 
 
88
  if node["type"] not in colors:
89
  colors[node["type"]] = get_random_light_color()
90
 
91
+ # for span in spans:
92
+ # print(f"Span: {span.text}, Label: {span.label_}")
93
 
94
  doc.set_ents(spans, default="unmodified")
95
  doc.spans["sc"] = spans
 
159
  raise gr.Error("Text and model must be provided.")
160
  json_data = extract(text, model)
161
  # json_data = json_example
 
162
  entities_viz = create_custom_entity_viz(json_data, text)
163
 
164
  graph_html = create_graph(json_data)
phi3_instruct_graph.py CHANGED
@@ -83,7 +83,7 @@ class Phi3InstructGraph:
83
  -------Text end-------
84
  """)
85
 
86
- if self.model == "EmergentMethods/Phi-3-medium-128k-instruct-graph":
87
  # model without system message
88
  messages = [
89
  {
@@ -109,6 +109,5 @@ class Phi3InstructGraph:
109
  def extract(self, text):
110
  messages = self._get_messages(text)
111
  pipe_output = self._generate(messages)
112
- print("pipe_output", pipe_output)
113
  print("pipe_output json", pipe_output[0]["generated_text"])
114
  return pipe_output[0]["generated_text"]
 
83
  -------Text end-------
84
  """)
85
 
86
+ if self.model_path == "EmergentMethods/Phi-3-medium-128k-instruct-graph":
87
  # model without system message
88
  messages = [
89
  {
 
109
  def extract(self, text):
110
  messages = self._get_messages(text)
111
  pipe_output = self._generate(messages)
 
112
  print("pipe_output json", pipe_output[0]["generated_text"])
113
  return pipe_output[0]["generated_text"]