app.py
Browse files
app.py
CHANGED
|
@@ -1,16 +1,10 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import subprocess
|
| 3 |
-
import shutil # For locating Java path dynamically
|
| 4 |
|
| 5 |
def chatbot_interface(question):
|
| 6 |
-
java_path = shutil.which("java") # Finds Java path dynamically
|
| 7 |
-
|
| 8 |
-
if not java_path:
|
| 9 |
-
return "Error: Java is not installed or not found in PATH."
|
| 10 |
-
|
| 11 |
try:
|
| 12 |
result = subprocess.run(
|
| 13 |
-
[
|
| 14 |
capture_output=True,
|
| 15 |
text=True
|
| 16 |
)
|
|
@@ -35,4 +29,4 @@ iface = gr.Interface(
|
|
| 35 |
description="Ask syllabus-related questions and get accurate responses."
|
| 36 |
)
|
| 37 |
|
| 38 |
-
iface.launch(
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import subprocess
|
|
|
|
| 3 |
|
| 4 |
def chatbot_interface(question):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
try:
|
| 6 |
result = subprocess.run(
|
| 7 |
+
['java', '-cp', '/app/lib/json-20210307.jar:/app', 'Main', question],
|
| 8 |
capture_output=True,
|
| 9 |
text=True
|
| 10 |
)
|
|
|
|
| 29 |
description="Ask syllabus-related questions and get accurate responses."
|
| 30 |
)
|
| 31 |
|
| 32 |
+
iface.launch()
|