Spaces:
Build error
Build error
app.py
Browse files
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,
|