Update app.py
Browse files1234567891011121314151617181920212223242526272829import gradio as gr# Load the model from Hugging Face Hubrepo_id = "rmaitest/mlmodel2" # Your model repository IDmodel = repo_id # Loads the inference function (predict_price)def predict_with_hf_model(size, bedrooms, age):"""Predicts house price using the model from Hugging Face Hub."""# Call the loaded inference functionresult = model.predict_price(size=size, bedrooms=bedrooms, age=age)predicted_price = result["predicted_price"] # Extract the predicted price# Format the outputreturn f"Predicted Price: ${predicted_price:,.2f}"# Create the Gradio interfaceiface = gr.Interface(fn=predict_with_hf_model,inputs=["number", "number", "number"],outputs="text",title="House Price Prediction",description="Enter house details to predict the price.",)# Launch the interfaceiface.launch()1234567891011121314151617import gradio as grfrom huggingface_hub import from_pretrained# Load the model (try with a built-in model first)model = from_pretrained("bert-base-uncased") # Or any other built-in HF modeldef predict_simple(text):return {"result": text.upper()}iface = gr.Interface(fn=predict_simple,inputs="text",outputs="text",title="Simple Text Uppercasing",)iface.launch()
app.py+8-20