Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,16 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
|
4 |
+
classifier = pipeline(model="Yanni8/star-predictor")
|
5 |
+
|
6 |
+
def predict(text):
|
7 |
+
labels = classifier(text, return_all_scores=True)[0]
|
8 |
+
return {label['label']: label['score'] for label in labels}
|
9 |
+
|
10 |
+
iface = gr.Interface(
|
11 |
+
fn=predict,
|
12 |
+
inputs=gr.Textbox(lines=7, label="Input Text"),
|
13 |
+
outputs=gr.Label(num_top_classes=3, label="Predicted Star")
|
14 |
+
)
|
15 |
+
|
16 |
+
iface.launch()
|