Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -50,7 +50,7 @@ def darcy_weisbach_calculation(
|
|
| 50 |
|
| 51 |
# Darcy–Weisbach head loss: h_f = f*(L/D)*(v^2/(2g))
|
| 52 |
g = 9.80665 # m/s^2
|
| 53 |
-
hf = f * (L/D) * (v
|
| 54 |
|
| 55 |
# Pressure drop: ΔP = rho*g*h_f
|
| 56 |
dP = rho * g * hf
|
|
@@ -136,27 +136,15 @@ def explain_results(structured_message):
|
|
| 136 |
context = json.dumps(structured_message, indent=2)
|
| 137 |
|
| 138 |
prompt = (
|
| 139 |
-
"You are an engineering tutor. Read the structured calculation JSON and produce a clear, concise explanation for a non-expert
|
| 140 |
-
"
|
| 141 |
-
"
|
| 142 |
-
"
|
| 143 |
-
"-
|
| 144 |
-
"
|
| 145 |
-
"-
|
| 146 |
-
"
|
| 147 |
-
"
|
| 148 |
-
"
|
| 149 |
-
"- Explain head loss and pressure drop magnitudes and practical implications.
|
| 150 |
-
"
|
| 151 |
-
"- If inputs look out of typical ranges, gently flag them.
|
| 152 |
-
"
|
| 153 |
-
"Stay under 180 words. Avoid equations in LaTeX; use plain words.
|
| 154 |
-
|
| 155 |
-
"
|
| 156 |
-
f"JSON:
|
| 157 |
-
{context}
|
| 158 |
-
|
| 159 |
-
"
|
| 160 |
"Explanation:"
|
| 161 |
)
|
| 162 |
out = llm(prompt, max_new_tokens=220)
|
|
|
|
| 50 |
|
| 51 |
# Darcy–Weisbach head loss: h_f = f*(L/D)*(v^2/(2g))
|
| 52 |
g = 9.80665 # m/s^2
|
| 53 |
+
hf = f * (L/D) * (v**2/(2*g))
|
| 54 |
|
| 55 |
# Pressure drop: ΔP = rho*g*h_f
|
| 56 |
dP = rho * g * hf
|
|
|
|
| 136 |
context = json.dumps(structured_message, indent=2)
|
| 137 |
|
| 138 |
prompt = (
|
| 139 |
+
"You are an engineering tutor. Read the structured calculation JSON and produce a clear, concise explanation for a non-expert.\n"
|
| 140 |
+
"Goals:\n"
|
| 141 |
+
"- Briefly restate the problem and assumptions.\n"
|
| 142 |
+
"- Highlight the formulas and what they mean physically.\n"
|
| 143 |
+
"- Interpret the Reynolds number and friction factor.\n"
|
| 144 |
+
"- Explain head loss and pressure drop magnitudes and practical implications.\n"
|
| 145 |
+
"- If inputs look out of typical ranges, gently flag them.\n"
|
| 146 |
+
"Stay under 180 words. Avoid equations in LaTeX; use plain words.\n\n"
|
| 147 |
+
f"JSON:\n{{context}}\n\n"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
"Explanation:"
|
| 149 |
)
|
| 150 |
out = llm(prompt, max_new_tokens=220)
|