Spaces:
Sleeping
Sleeping
Akshay
commited on
Commit
·
70e7b6a
1
Parent(s):
f96adeb
Added plotly
Browse files
app.py
CHANGED
|
@@ -1,6 +1,37 @@
|
|
| 1 |
import pickle as pkl
|
| 2 |
import plotly.express as px
|
| 3 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
# Load the job stack count data
|
| 6 |
with open("job_stack_count.pkl", "rb") as f:
|
|
@@ -25,22 +56,26 @@ def generate_treemap(category: str):
|
|
| 25 |
|
| 26 |
fig = px.treemap(
|
| 27 |
names=stat_dict_keys,
|
| 28 |
-
parents=[""
|
| 29 |
values=stat_dict_values,
|
| 30 |
hover_name=hover_text
|
| 31 |
)
|
| 32 |
fig.update_layout(title=category)
|
| 33 |
return fig
|
| 34 |
|
| 35 |
-
# Create a Gradio interface
|
| 36 |
categories = list(job_stack_count.keys())
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
# Launch the app
|
| 46 |
-
demo.launch(
|
|
|
|
| 1 |
import pickle as pkl
|
| 2 |
import plotly.express as px
|
| 3 |
import gradio as gr
|
| 4 |
+
from pydantic import BaseModel, Field
|
| 5 |
+
from typing import List
|
| 6 |
+
|
| 7 |
+
with open("job_stack_count.pkl", "rb") as f:
|
| 8 |
+
job_stack_count = pkl.load(f)
|
| 9 |
+
|
| 10 |
+
job_stack_count['Generative_AI_Frameworks']['Pydantic'] = 1
|
| 11 |
+
job_stack_count['Programming_Languages']['C#'] = 1
|
| 12 |
+
|
| 13 |
+
class TechStack(BaseModel):
|
| 14 |
+
GPU_Frameworks: List[str] = Field(..., alias="GPU Frameworks")
|
| 15 |
+
Programming_Languages: List[str] = Field(..., alias="Programming Languages")
|
| 16 |
+
Generative_AI_Frameworks: List[str] = Field(..., alias="Generative AI Frameworks")
|
| 17 |
+
Databases: List[str] = Field(..., alias="Databases")
|
| 18 |
+
Orchestration_Deployment: List[str] = Field(..., alias="Orchestration & Deployment")
|
| 19 |
+
APIs_Web_Frameworks: List[str] = Field(..., alias="APIs & Web Frameworks")
|
| 20 |
+
Big_Data_Technologies: List[str] = Field(..., alias="Big Data Technologies")
|
| 21 |
+
Cloud_Platforms_Services: List[str] = Field(..., alias="Cloud Platforms & Services")
|
| 22 |
+
Machine_Learning_Deep_Learning_Libraries: List[str] = Field(..., alias="Machine Learning & Deep Learning Libraries")
|
| 23 |
+
Data_Visualization_Tools: List[str] = Field(..., alias="Data Visualization Tools")
|
| 24 |
+
CI_CD_MLOps: List[str] = Field(..., alias="CI/CD & MLOps")
|
| 25 |
+
Model_Formats_Optimization: List[str] = Field(..., alias="Model Formats & Optimization")
|
| 26 |
+
Qualifications: List[str] = Field(..., alias="Qualifications")
|
| 27 |
+
Machine_Learning_AI_Techniques: List[str] = Field(..., alias="Machine Learning & AI Techniques")
|
| 28 |
+
Machine_Learning_AI_Models: List[str] = Field(..., alias="Machine Learning & AI Models")
|
| 29 |
+
Tasks_Responsibilities: List[str] = Field(..., alias="Tasks & Responsibilities")
|
| 30 |
+
Soft_Skills: List[str] = Field(..., alias="Soft Skills")
|
| 31 |
+
Miscellaneous: List[str] = Field(..., alias="Miscellaneous")
|
| 32 |
+
|
| 33 |
+
class Config:
|
| 34 |
+
populate_by_name = True
|
| 35 |
|
| 36 |
# Load the job stack count data
|
| 37 |
with open("job_stack_count.pkl", "rb") as f:
|
|
|
|
| 56 |
|
| 57 |
fig = px.treemap(
|
| 58 |
names=stat_dict_keys,
|
| 59 |
+
parents=["" for _ in stat_dict_keys],
|
| 60 |
values=stat_dict_values,
|
| 61 |
hover_name=hover_text
|
| 62 |
)
|
| 63 |
fig.update_layout(title=category)
|
| 64 |
return fig
|
| 65 |
|
| 66 |
+
# Create a Gradio interface in vertical layout
|
| 67 |
categories = list(job_stack_count.keys())
|
| 68 |
+
with gr.Blocks() as demo:
|
| 69 |
+
gr.Markdown("# Tech Stack Treemap Visualization")
|
| 70 |
+
gr.Markdown("Select a category to visualize the distribution of job tech stacks.")
|
| 71 |
+
|
| 72 |
+
with gr.Column(): # Ensures vertical layout
|
| 73 |
+
category_input = gr.Dropdown(choices=categories, label="Select Category")
|
| 74 |
+
output_plot = gr.Plot()
|
| 75 |
+
|
| 76 |
+
category_input.change(generate_treemap, inputs=category_input, outputs=output_plot)
|
| 77 |
+
|
| 78 |
+
demo.launch()
|
| 79 |
|
| 80 |
# Launch the app
|
| 81 |
+
demo.launch()
|