MBG0903 commited on
Commit
57b2968
Β·
verified Β·
1 Parent(s): feec3b3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +67 -23
app.py CHANGED
@@ -1,47 +1,91 @@
1
  import gradio as gr
2
 
3
- # Expanded Hydraulic Q&A logic
4
  def hydraulics_assistant(message, history):
5
  message = message.lower()
6
 
7
- if "cylinder moving slowly" in message:
8
- return "Possible causes: internal leakage, low fluid level, clogged filters, or incorrect valve settings."
9
-
10
- elif "overheating" in message:
11
- return "Check for clogged filters, insufficient fluid levels, or excessive system pressure. Also inspect for continuous duty cycles."
 
 
12
 
13
  elif "oil" in message and "200 bar" in message:
14
- return "Use ISO VG 46 or VG 68 grade hydraulic oil for 200 bar systems. Confirm with your equipment manual or supplier."
15
-
16
- elif "pressure range" in message:
17
- return "For standard hydraulic presses, operating pressure is typically 120–180 bar. Always refer to your equipment manual."
 
 
 
 
18
 
19
- elif "oil change" in message or "fluid change" in message:
20
- return "Hydraulic fluid should be replaced every 2000 operating hours or as recommended by your OEM."
 
 
 
 
 
 
 
 
 
21
 
22
- elif "pressure drop" in message:
23
- return "Possible causes: leaks in hoses or seals, clogged filters, or worn pump components."
 
 
 
 
 
 
 
 
24
 
25
- elif "spare parts" in message or "replacement" in message:
26
- return "Please contact your authorized dealer or our maintenance team at +91-12345-67890."
 
 
 
 
 
 
 
27
 
28
- elif "noise" in message or "whining" in message:
29
- return "Noise can be caused by cavitation, aeration, low fluid levels, or a failing pump. Check fluid and inspect inlet lines."
 
 
 
 
 
 
 
 
30
 
31
- elif "filter replacement" in message or "when to change filter" in message:
32
- return "Hydraulic filters should be checked every 500 hours and replaced every 1000 hours or per manufacturer instructions."
 
 
 
 
33
 
34
  else:
35
- return "Sorry, I don't have that info. Please consult your maintenance engineer."
 
 
 
36
 
37
- # Chat Interface setup
38
  demo = gr.ChatInterface(
39
  hydraulics_assistant,
40
  title="Hydraulic Maintenance Assistant Bot",
41
  description="Ask your hydraulic maintenance questions β€” get instant answers to common issues!"
42
  )
43
 
44
- # Run the app
45
  if __name__ == "__main__":
46
  demo.launch()
47
 
 
1
  import gradio as gr
2
 
3
+ # Enhanced Hydraulic Q&A
4
  def hydraulics_assistant(message, history):
5
  message = message.lower()
6
 
7
+ if "pressure range" in message or "operating pressure" in message:
8
+ return (
9
+ "🧭 **Recommended Pressure Range:**\n"
10
+ "For standard hydraulic presses, the operating pressure is typically between 120 and 180 bar. "
11
+ "However, this can vary based on the type of machinery and application. Always consult your equipment manual "
12
+ "or manufacturer to ensure the pressure setting aligns with system requirements."
13
+ )
14
 
15
  elif "oil" in message and "200 bar" in message:
16
+ return (
17
+ "πŸ›’οΈ **Oil Type for 200 Bar Press:**\n"
18
+ "Use ISO VG 46 or VG 68 grade hydraulic oil for 200 bar hydraulic systems. These oils provide a good balance of viscosity, "
19
+ "thermal stability, and wear protection. Selection depends on ambient operating temperatures:\n"
20
+ "- Use VG 46 in moderate climates\n"
21
+ "- Use VG 68 in hotter environments\n"
22
+ "βœ… Always verify compatibility with OEM recommendations or consult your equipment supplier."
23
+ )
24
 
25
+ elif "overheating" in message or "too hot" in message:
26
+ return (
27
+ "πŸ”₯ **Hydraulic System Overheating – Possible Causes & Fixes:**\n"
28
+ "- Dirty or clogged filters causing restricted flow\n"
29
+ "- Low fluid levels or poor-quality oil\n"
30
+ "- Undersized or failing heat exchanger\n"
31
+ "- Continuous high-duty cycle without rest\n\n"
32
+ "**Fix:**\n"
33
+ "Clean or replace filters, top-up fluid, inspect cooling system, and monitor temperature with a thermal gun. "
34
+ "If persistent, consider upgrading the cooling system."
35
+ )
36
 
37
+ elif "noise" in message or "whining" in message:
38
+ return (
39
+ "πŸ”Š **Why Your Pump is Making a Whining Noise:**\n"
40
+ "This could be caused by:\n"
41
+ "- Cavitation due to air bubbles in the fluid\n"
42
+ "- Low hydraulic fluid level\n"
43
+ "- Clogged suction line or filter\n"
44
+ "- Failing pump bearings\n\n"
45
+ "πŸ‘‰ Check fluid level, inspect for air leaks, and clean the filters. Prolonged noise may damage components, so act promptly."
46
+ )
47
 
48
+ elif "fluid change" in message or "oil change" in message:
49
+ return (
50
+ "πŸ”„ **Hydraulic Fluid Change Frequency:**\n"
51
+ "Hydraulic oil should typically be replaced every 2000 operating hours, but this can vary depending on:\n"
52
+ "- Operating environment (dusty, hot, etc.)\n"
53
+ "- Load cycles and pressure\n"
54
+ "- Fluid quality and contamination\n\n"
55
+ "πŸ“˜ Tip: Monitor oil condition using sampling kits and follow the OEM schedule."
56
+ )
57
 
58
+ elif "pressure drop" in message:
59
+ return (
60
+ "πŸ“‰ **Pressure Drop in Hydraulic Systems:**\n"
61
+ "Potential reasons include:\n"
62
+ "- Leaks in hoses, fittings, or seals\n"
63
+ "- Clogged return filters\n"
64
+ "- Faulty pressure relief valves\n"
65
+ "- Air in the hydraulic lines\n\n"
66
+ "πŸ” Start by inspecting visible components, then move to internal checks if needed."
67
+ )
68
 
69
+ elif "spare part" in message or "replacement" in message:
70
+ return (
71
+ "πŸ”§ **Spare Parts or Replacements:**\n"
72
+ "Please contact your authorized dealer or the maintenance support team with your equipment model number. "
73
+ "They can guide you to compatible parts or help verify the specifications for ordering replacements."
74
+ )
75
 
76
  else:
77
+ return (
78
+ "πŸ€– Sorry, I don't have information on that specific query.\n"
79
+ "Please consult your maintenance engineer or refer to the equipment manual for detailed guidance."
80
+ )
81
 
82
+ # Launch the Gradio chatbot
83
  demo = gr.ChatInterface(
84
  hydraulics_assistant,
85
  title="Hydraulic Maintenance Assistant Bot",
86
  description="Ask your hydraulic maintenance questions β€” get instant answers to common issues!"
87
  )
88
 
 
89
  if __name__ == "__main__":
90
  demo.launch()
91