Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -18,22 +18,10 @@ def classify_text(text):
|
|
18 |
{"label": item["label"], "score": round(item["score"], 4)}
|
19 |
for result in results for item in result
|
20 |
]
|
21 |
-
|
|
|
|
|
|
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
# Create the Gradio interface
|
26 |
-
with gr.Blocks() as demo:
|
27 |
-
gr.Markdown("# Text Classification with Hugging Face Transformers")
|
28 |
-
gr.Markdown("Enter text to classify using the model: **Karzan/user_profile_skills_model**.")
|
29 |
-
with gr.Row():
|
30 |
-
with gr.Column():
|
31 |
-
input_text = gr.Textbox(label="Input Text", lines=3, placeholder="Type something...")
|
32 |
-
classify_button = gr.Button("Classify")
|
33 |
-
with gr.Column():
|
34 |
-
output_text = gr.JSON(label="Classification Results")
|
35 |
-
|
36 |
-
classify_button.click(classify_text, inputs=input_text, outputs=output_text)
|
37 |
-
|
38 |
-
# Launch the app
|
39 |
-
demo.launch()
|
|
|
18 |
{"label": item["label"], "score": round(item["score"], 4)}
|
19 |
for result in results for item in result
|
20 |
]
|
21 |
+
output = {}
|
22 |
+
for i in range(len(formatted_results['labels'])):
|
23 |
+
output[formatted_results['labels'][i]] = prediction['scores'][i]
|
24 |
+
return output
|
25 |
|
26 |
+
demo = gr.Interface(fn=classify_text, inputs=[gr.Textbox(label="Input")], outputs=gr.Label(label="Classification"), title="Text Classification")
|
27 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|