import gradio as gr from transformers import AutoTokenizer, AutoModelForCausalLM # Load tokenizer and model 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 # Create Gradio interface iface = gr.Interface(fn=predict, inputs="text", outputs="text", title="Phi3 Law Case Management Model", description="A model to assist with law case management.") # Launch the Gradio app iface.launch()