vrkforever commited on
Commit
ac964df
·
verified ·
1 Parent(s): 8cd7691

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -7,12 +7,12 @@ def extract_apk_info(apk_file):
7
  if apk_file is None:
8
  return "No file uploaded. Please upload an APK file."
9
 
10
- # Create a temporary file to store the uploaded APK
11
- with tempfile.NamedTemporaryFile(delete=False, suffix=".apk") as temp_apk:
12
- temp_apk.write(apk_file.read())
13
- temp_apk_path = temp_apk.name
14
-
15
  try:
 
 
 
 
 
16
  apk = APK(temp_apk_path)
17
 
18
  output = []
@@ -46,7 +46,8 @@ def extract_apk_info(apk_file):
46
  return f"Error analyzing APK: {str(e)}"
47
  finally:
48
  # Clean up the temporary file
49
- os.unlink(temp_apk_path)
 
50
 
51
  # Create Gradio interface
52
  iface = gr.Interface(
 
7
  if apk_file is None:
8
  return "No file uploaded. Please upload an APK file."
9
 
 
 
 
 
 
10
  try:
11
+ # Create a temporary file
12
+ with tempfile.NamedTemporaryFile(delete=False, suffix=".apk") as temp_apk:
13
+ temp_apk.write(apk_file.read())
14
+ temp_apk_path = temp_apk.name
15
+
16
  apk = APK(temp_apk_path)
17
 
18
  output = []
 
46
  return f"Error analyzing APK: {str(e)}"
47
  finally:
48
  # Clean up the temporary file
49
+ if os.path.exists(temp_apk_path):
50
+ os.unlink(temp_apk_path)
51
 
52
  # Create Gradio interface
53
  iface = gr.Interface(