Spaces:
Build error
Build error
Commit ·
9570084
1
Parent(s): 48e1252
managed to implement working .csv handling
Browse files
__pycache__/config.cpython-310.pyc
CHANGED
|
Binary files a/__pycache__/config.cpython-310.pyc and b/__pycache__/config.cpython-310.pyc differ
|
|
|
app.py
CHANGED
|
@@ -67,33 +67,33 @@ with gr.Blocks() as demo:
|
|
| 67 |
updated_values[8] = csv_data.get('project_name', '') # publisher_projectName (8)
|
| 68 |
|
| 69 |
# ========== SYSTEM ==========
|
| 70 |
-
updated_values[
|
| 71 |
-
updated_values[
|
| 72 |
-
updated_values[
|
| 73 |
|
| 74 |
# ========== MEASURES ==========
|
| 75 |
-
updated_values[
|
| 76 |
-
updated_values[
|
| 77 |
-
updated_values[
|
| 78 |
|
| 79 |
# Duration conversion (hours → seconds)
|
| 80 |
if 'duration' in csv_data:
|
| 81 |
try:
|
| 82 |
hours = float(csv_data['duration'])
|
| 83 |
-
updated_values[
|
| 84 |
except:
|
| 85 |
-
updated_values[
|
| 86 |
|
| 87 |
-
updated_values[
|
| 88 |
|
| 89 |
# ========== SOFTWARE ==========
|
| 90 |
-
updated_values[
|
| 91 |
-
updated_values[
|
| 92 |
|
| 93 |
# ========== INFRASTRUCTURE ==========
|
| 94 |
# infraType (58) - Dropdown
|
| 95 |
on_cloud = str(csv_data.get('on_cloud', 'No')).lower().strip()
|
| 96 |
-
updated_values[
|
| 97 |
|
| 98 |
# Cloud fields (59-60)
|
| 99 |
updated_values[59] = csv_data.get('cloud_provider', '') if on_cloud == "yes" else ""
|
|
@@ -104,11 +104,11 @@ with gr.Blocks() as demo:
|
|
| 104 |
cpu_count = int(csv_data.get('cpu_count', 0))
|
| 105 |
|
| 106 |
if gpu_count > 0:
|
| 107 |
-
|
| 108 |
updated_values[62] = str(gpu_count) # nbComponent (62)
|
| 109 |
model = csv_data.get('gpu_model', '')
|
| 110 |
elif cpu_count > 0:
|
| 111 |
-
|
| 112 |
updated_values[62] = str(cpu_count) # nbComponent (62)
|
| 113 |
model = csv_data.get('cpu_model', '')
|
| 114 |
else:
|
|
@@ -121,19 +121,19 @@ with gr.Blocks() as demo:
|
|
| 121 |
# Split model into manufacturer/family/series (64-66)
|
| 122 |
if model:
|
| 123 |
parts = model.replace("(R)", "").replace("(TM)", "").split()
|
| 124 |
-
updated_values[
|
| 125 |
-
updated_values[
|
| 126 |
-
updated_values[
|
| 127 |
else:
|
| 128 |
-
updated_values[
|
| 129 |
|
| 130 |
updated_values[67] = "" # share (67)
|
| 131 |
|
| 132 |
# ========== ENVIRONMENT ==========
|
| 133 |
-
updated_values[
|
| 134 |
-
updated_values[
|
| 135 |
-
updated_values[
|
| 136 |
-
updated_values[
|
| 137 |
|
| 138 |
except Exception as e:
|
| 139 |
print(f"CSV Processing Error: {str(e)}")
|
|
@@ -174,9 +174,11 @@ with gr.Blocks() as demo:
|
|
| 174 |
outputs=output
|
| 175 |
)
|
| 176 |
|
| 177 |
-
|
|
|
|
| 178 |
|
| 179 |
if __name__ == "__main__":
|
| 180 |
demo.launch()
|
|
|
|
| 181 |
|
| 182 |
|
|
|
|
| 67 |
updated_values[8] = csv_data.get('project_name', '') # publisher_projectName (8)
|
| 68 |
|
| 69 |
# ========== SYSTEM ==========
|
| 70 |
+
updated_values[54] = csv_data.get('os', '') # os (index 53)
|
| 71 |
+
updated_values[55] = "" # distribution (54)
|
| 72 |
+
updated_values[56] = "" # distributionVersion (55)
|
| 73 |
|
| 74 |
# ========== MEASURES ==========
|
| 75 |
+
updated_values[40] = csv_data.get('tracking_mode', '') # measurementMethod (39)
|
| 76 |
+
updated_values[48] = "kWh" # unit (47)
|
| 77 |
+
updated_values[51] = csv_data.get('energy_consumed', '') # powerConsumption (50)
|
| 78 |
|
| 79 |
# Duration conversion (hours → seconds)
|
| 80 |
if 'duration' in csv_data:
|
| 81 |
try:
|
| 82 |
hours = float(csv_data['duration'])
|
| 83 |
+
updated_values[52] = str(round(hours * 3600, 2)) # measurementDuration (51)
|
| 84 |
except:
|
| 85 |
+
updated_values[52] = ""
|
| 86 |
|
| 87 |
+
updated_values[53] = csv_data.get('timestamp', '') # measurementDateTime (52)
|
| 88 |
|
| 89 |
# ========== SOFTWARE ==========
|
| 90 |
+
updated_values[57] = "Python" # language (56)
|
| 91 |
+
updated_values[58] = csv_data.get('python_version', '') # version_software (57)
|
| 92 |
|
| 93 |
# ========== INFRASTRUCTURE ==========
|
| 94 |
# infraType (58) - Dropdown
|
| 95 |
on_cloud = str(csv_data.get('on_cloud', 'No')).lower().strip()
|
| 96 |
+
updated_values[59] = "publicCloud" if on_cloud == "yes" else "onPremise"
|
| 97 |
|
| 98 |
# Cloud fields (59-60)
|
| 99 |
updated_values[59] = csv_data.get('cloud_provider', '') if on_cloud == "yes" else ""
|
|
|
|
| 104 |
cpu_count = int(csv_data.get('cpu_count', 0))
|
| 105 |
|
| 106 |
if gpu_count > 0:
|
| 107 |
+
|
| 108 |
updated_values[62] = str(gpu_count) # nbComponent (62)
|
| 109 |
model = csv_data.get('gpu_model', '')
|
| 110 |
elif cpu_count > 0:
|
| 111 |
+
u
|
| 112 |
updated_values[62] = str(cpu_count) # nbComponent (62)
|
| 113 |
model = csv_data.get('cpu_model', '')
|
| 114 |
else:
|
|
|
|
| 121 |
# Split model into manufacturer/family/series (64-66)
|
| 122 |
if model:
|
| 123 |
parts = model.replace("(R)", "").replace("(TM)", "").split()
|
| 124 |
+
updated_values[65] = parts[0] if parts else "" # manufacturer_infra (64)
|
| 125 |
+
updated_values[66] = " ".join(parts[1:3]) if len(parts) >= 3 else "" # family (65)
|
| 126 |
+
updated_values[67] = " ".join(parts[3:]) if len(parts) > 3 else "" # series (66)
|
| 127 |
else:
|
| 128 |
+
updated_values[65] = updated_values[66] = updated_values[67] = ""
|
| 129 |
|
| 130 |
updated_values[67] = "" # share (67)
|
| 131 |
|
| 132 |
# ========== ENVIRONMENT ==========
|
| 133 |
+
updated_values[69] = csv_data.get('country_name', '') # country (68)
|
| 134 |
+
updated_values[70] = csv_data.get('latitude', '') # latitude (69)
|
| 135 |
+
updated_values[71] = csv_data.get('longitude', '') # longitude (70)
|
| 136 |
+
updated_values[72] = csv_data.get('region', '') # location (71)
|
| 137 |
|
| 138 |
except Exception as e:
|
| 139 |
print(f"CSV Processing Error: {str(e)}")
|
|
|
|
| 174 |
outputs=output
|
| 175 |
)
|
| 176 |
|
| 177 |
+
print(all_form_components)
|
| 178 |
+
print(len(all_form_components))
|
| 179 |
|
| 180 |
if __name__ == "__main__":
|
| 181 |
demo.launch()
|
| 182 |
+
print(all_form_components)
|
| 183 |
|
| 184 |
|
services/__pycache__/huggingface.cpython-310.pyc
CHANGED
|
Binary files a/services/__pycache__/huggingface.cpython-310.pyc and b/services/__pycache__/huggingface.cpython-310.pyc differ
|
|
|
services/__pycache__/json_generator.cpython-310.pyc
CHANGED
|
Binary files a/services/__pycache__/json_generator.cpython-310.pyc and b/services/__pycache__/json_generator.cpython-310.pyc differ
|
|
|
ui/__pycache__/form_components.cpython-310.pyc
CHANGED
|
Binary files a/ui/__pycache__/form_components.cpython-310.pyc and b/ui/__pycache__/form_components.cpython-310.pyc differ
|
|
|
ui/form_components.py
CHANGED
|
@@ -273,11 +273,12 @@ def create_software_tab():
|
|
| 273 |
def create_infrastructure_tab():
|
| 274 |
"""Create the infrastructure tab components."""
|
| 275 |
with gr.Tab("Infrastructure"):
|
| 276 |
-
infraType = gr.Dropdown(
|
| 277 |
-
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
|
|
|
|
| 281 |
cloudProvider = gr.Textbox(label="Cloud Provider", info="(name of your cloud provider)")
|
| 282 |
cloudInstance = gr.Textbox(label="Cloud Instance", info="(name of your cloud instance)")
|
| 283 |
with gr.Accordion("Components"):
|
|
|
|
| 273 |
def create_infrastructure_tab():
|
| 274 |
"""Create the infrastructure tab components."""
|
| 275 |
with gr.Tab("Infrastructure"):
|
| 276 |
+
infraType = gr.Dropdown(
|
| 277 |
+
value=INFRA_TYPES[2], # Default to "onPremise"
|
| 278 |
+
label="Infrastructure Type",
|
| 279 |
+
choices=INFRA_TYPES,
|
| 280 |
+
info="Required field<br>(the type of infrastructure used)"
|
| 281 |
+
)
|
| 282 |
cloudProvider = gr.Textbox(label="Cloud Provider", info="(name of your cloud provider)")
|
| 283 |
cloudInstance = gr.Textbox(label="Cloud Instance", info="(name of your cloud instance)")
|
| 284 |
with gr.Accordion("Components"):
|