Spaces:
Running on Zero
Running on Zero
Fix medium phi3
Browse filesFiles changed (2)
- app.py+2-4
- phi3_instruct_graph.py+1-2
79 unmodified lines808182838485862 unmodified lines899091929394959663 unmodified lines16016116216316416516679 unmodified linesstart = dataentity["start"]end = dataentity["end"]print("entity spans:", entity_spans)if start < len(doc) and end <= len(doc):span = Span(doc, start, end, label=node["type"])2 unmodified linesif node["type"] not in colors:colors[node["type"]] = get_random_light_color()for span in spans:print(f"Span: {span.text}, Label: {span.label_}")doc.set_ents(spans, default="unmodified")doc.spans["sc"] = spans63 unmodified linesraise gr.Error("Text and model must be provided.")json_data = extract(text, model)# json_data = json_exampleprint(json_data)entities_viz = create_custom_entity_viz(json_data, text)graph_html = create_graph(json_data)79 unmodified lines8081828384852 unmodified lines888990919293949563 unmodified lines15916016116216316479 unmodified linesstart = dataentity["start"]end = dataentity["end"]if start < len(doc) and end <= len(doc):span = Span(doc, start, end, label=node["type"])2 unmodified linesif node["type"] not in colors:colors[node["type"]] = get_random_light_color()# for span in spans:# print(f"Span: {span.text}, Label: {span.label_}")doc.set_ents(spans, default="unmodified")doc.spans["sc"] = spans63 unmodified linesraise gr.Error("Text and model must be provided.")json_data = extract(text, model)# json_data = json_exampleentities_viz = create_custom_entity_viz(json_data, text)graph_html = create_graph(json_data)
82 unmodified lines8384858687888919 unmodified lines10911011111211311482 unmodified lines-------Text end-------""")if self.model == "EmergentMethods/Phi-3-medium-128k-instruct-graph":# model without system messagemessages = [{19 unmodified linesdef extract(self, text):messages = self._get_messages(text)pipe_output = self._generate(messages)print("pipe_output", pipe_output)print("pipe_output json", pipe_output[0]["generated_text"])return pipe_output[0]["generated_text"]82 unmodified lines8384858687888919 unmodified lines10911011111211382 unmodified lines-------Text end-------""")if self.model_path == "EmergentMethods/Phi-3-medium-128k-instruct-graph":# model without system messagemessages = [{19 unmodified linesdef extract(self, text):messages = self._get_messages(text)pipe_output = self._generate(messages)print("pipe_output json", pipe_output[0]["generated_text"])return pipe_output[0]["generated_text"]
app.py+2-4
phi3_instruct_graph.py+1-2