saiyadri commited on
Commit
77b39da
1 Parent(s): 97cb092
Files changed (1) hide show
  1. app.py +24 -0
app.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import joblib # Only for demonstration, use joblib if your model is saved with joblib
3
+
4
+ # Load your machine learning model
5
+ # Replace this with your actual model loading code
6
+ # Example with a dummy sentiment analysis model
7
+ # model = joblib.load('your_model_path.joblib')
8
+ def predict_sentiment(text):
9
+ # Replace this with your actual model prediction code
10
+ # Example with a dummy sentiment analysis model
11
+ model = joblib.load("pipeline_model.joblib")
12
+ prediction = model.predict([text])
13
+ return prediction
14
+
15
+ # Create a Gradio interface
16
+ iface = gr.Interface(
17
+ fn=predict_sentiment, # Your prediction function
18
+ inputs=gr.Textbox(), # Text input box
19
+ outputs=gr.Textbox(), # Display prediction output
20
+ live=True # Update predictions as you type
21
+ )
22
+
23
+ # Launch the interface on a local server
24
+ iface.launch()