Spaces:
Sleeping
Sleeping
!pip install gradio transformers | |
import gradio as gr | |
#gr.load("models/sengeolab/geocoder").launch() | |
#import gradio as gr | |
from transformers import AutoTokenizer, AutoModelForSequenceClassification | |
# Load the model and tokenizer | |
model_name = "sengeolab/geocode" # This should be the correct model identifier | |
tokenizer = AutoTokenizer.from_pretrained(model_name) | |
model = AutoModelForSequenceClassification.from_pretrained(model_name) | |
# 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() | |