anithai commited on
Commit
2ef9c43
·
verified ·
1 Parent(s): 9e9f0fc
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -1,10 +1,13 @@
1
  import gradio as gr
2
  import subprocess
 
3
 
4
  def chatbot_interface(question):
 
 
 
 
5
  try:
6
- # Specify the full Java path for Hugging Face Spaces
7
- java_path = "/usr/bin/java"
8
  result = subprocess.run(
9
  [java_path, '-cp', '.:/app/json-20210307.jar', 'Main', question],
10
  capture_output=True,
 
1
  import gradio as gr
2
  import subprocess
3
+ import shutil # For checking Java path
4
 
5
  def chatbot_interface(question):
6
+ java_path = shutil.which("java") # Finds Java's path dynamically
7
+ if not java_path:
8
+ return "Error: Java is not installed or cannot be found."
9
+
10
  try:
 
 
11
  result = subprocess.run(
12
  [java_path, '-cp', '.:/app/json-20210307.jar', 'Main', question],
13
  capture_output=True,