|
import gradio as gr |
|
from transformers import AutoTokenizer, AutoModelForCausalLM |
|
|
|
|
|
tokenizer = AutoTokenizer.from_pretrained("TuringsSolutions/Phi3LawCaseManagement", trust_remote_code=True) |
|
model = AutoModelForCausalLM.from_pretrained("TuringsSolutions/Phi3LawCaseManagement", trust_remote_code=True) |
|
|
|
def predict(prompt): |
|
inputs = tokenizer(prompt, return_tensors="pt") |
|
outputs = model.generate(**inputs) |
|
response = tokenizer.decode(outputs[0], skip_special_tokens=True) |
|
return response |
|
|
|
|
|
iface = gr.Interface(fn=predict, |
|
inputs="text", |
|
outputs="text", |
|
title="Phi3 Law Case Management Model", |
|
description="A model to assist with law case management.") |
|
|
|
|
|
iface.launch() |
|
|