Spaces:
Sleeping
Sleeping
Create app.py
Browse files
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/DisorderDetectionModel")
|
| 6 |
+
|
| 7 |
+
# Define the inference function
|
| 8 |
+
def predict_disorder(text):
|
| 9 |
+
result = model(text)
|
| 10 |
+
return result
|
| 11 |
+
|
| 12 |
+
# Create a Gradio interface
|
| 13 |
+
interface = gr.Interface(fn=predict_disorder, inputs="text", outputs="json")
|
| 14 |
+
|
| 15 |
+
# Launch the app
|
| 16 |
+
interface.launch()
|