import gradio as gr # Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("sengeolab/geocode") model = AutoModel.from_pretrained("sengeolab/geocode") # Define your Gradio interface inputs = gr.Textbox(lines=3, label="Input Address") outputs = gr.Label(label="Geocoded Location") def geocode_address(address): # Tokenize the input text inputs = tokenizer(address, return_tensors="pt", padding=True, truncation=True) # Perform inference outputs = model(**inputs) # Add your inference logic here # For example, you can process the outputs and return the geocoded location return "Geocoded Location" # Replace this with your actual output # Launch the Gradio interface gr.Interface(fn=geocode_address, inputs=inputs, outputs=outputs).launch()