Spaces:
Sleeping
Sleeping
Download app.py from Phurpa/Textile_Bht_Pattern: direct link, hf CLI and curl.
- Browser
- Download file 719 Bytes
-
https://huggingface.co/spaces/Phurpa/Textile_Bht_Pattern/resolve/main/app.py
- Command line
-
hf download hf://spaces/Phurpa/Textile_Bht_Pattern/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Phurpa/Textile_Bht_Pattern/resolve/main/app.py
719 Bytes
| import gradio as gr | |
| import numpy as np | |
| # Function to classify images into 7 classes | |
| def image_classifier(inp): | |
| # Dummy classification logic | |
| # Generating random confidence scores for each class | |
| confidence_scores = np.random.rand(7) | |
| # Normalizing confidence scores to sum up to 1 | |
| confidence_scores /= np.sum(confidence_scores) | |
| # Creating a dictionary with class labels and corresponding confidence scores | |
| classes = ['Hor', 'Jadrima', 'Kishuthara', 'Marthra', 'Pangtse', 'Serthra', 'Shinglo'] | |
| result = {classes[i]: confidence_scores[i] for i in range(7)} | |
| return result | |
| # Creating Gradio interface | |
| demo = gr.Interface(fn=image_classifier, inputs="image", outputs="label") | |
| demo.launch() |