Spaces:
Runtime error
Runtime error
Ramesh-vani
commited on
Commit
·
430424b
1
Parent(s):
d29916e
Update app.py
Browse files
app.py
CHANGED
@@ -2,11 +2,11 @@ import gradio
|
|
2 |
import subprocess
|
3 |
import re
|
4 |
|
5 |
-
def extract_class_name(java_code):
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
|
11 |
def run_command(command):
|
12 |
process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
@@ -38,8 +38,8 @@ def run_code(command):
|
|
38 |
except subprocess.CalledProcessError as e:
|
39 |
result = str(e)
|
40 |
elif lang == 'java':
|
41 |
-
class_name = extract_class_name(code)
|
42 |
-
|
43 |
try:
|
44 |
|
45 |
with open(f'{class_name}.java', 'w') as f:
|
|
|
2 |
import subprocess
|
3 |
import re
|
4 |
|
5 |
+
# def extract_class_name(java_code):
|
6 |
+
# match = re.search(r'class\s+(\w+)\s*\{', java_code)
|
7 |
+
# if match:
|
8 |
+
# return match.group(1)
|
9 |
+
# return None
|
10 |
|
11 |
def run_command(command):
|
12 |
process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
|
|
38 |
except subprocess.CalledProcessError as e:
|
39 |
result = str(e)
|
40 |
elif lang == 'java':
|
41 |
+
# class_name = extract_class_name(code)
|
42 |
+
class_name = 'main'
|
43 |
try:
|
44 |
|
45 |
with open(f'{class_name}.java', 'w') as f:
|