LEGENDCODER1 commited on
Commit
e5257aa
·
verified ·
1 Parent(s): f771d07

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+ import gradio as gr
3
+
4
+ # Use a lightweight model for testing
5
+ model = pipeline("text-classification", model="distilbert-base-uncased-finetuned-sst-2-english")
6
+
7
+ # A simple function to test the app
8
+ def classify_text(text):
9
+ return model(text)
10
+
11
+ # Gradio interface
12
+ interface = gr.Interface(
13
+ fn=classify_text,
14
+ inputs="text",
15
+ outputs="json",
16
+ title="Text Classification Test",
17
+ description="Enter a sentence to classify its sentiment."
18
+ )
19
+
20
+ # Launch the app
21
+ if __name__ == "__main__":
22
+ interface.launch(server_name="0.0.0.0")