hasanmustafa0503 commited on
Commit
163f8e3
·
verified ·
1 Parent(s): d13b91c

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -0
app.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # Load the pre-trained model
5
+ model = pipeline("text-classification", model="hasanmustafa0503/SentimentModel")
6
+
7
+ # Define the inference function
8
+ def predict_sentiment(text):
9
+ result = model(text)
10
+ return result
11
+
12
+ # Create a Gradio interface
13
+ interface = gr.Interface(fn=predict_sentiment, inputs="text", outputs="json")
14
+
15
+ # Launch the app
16
+ interface.launch()