File size: 748 Bytes
2cfaeb7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import gradio as gr
import subprocess
import tempfile
import os
import shutil

def generate_apk(url):
    with tempfile.TemporaryDirectory() as tmpdir:
        output_apk = os.path.join(tmpdir, "output.apk")
        try:
            subprocess.run(["bash", "build_apk.sh", url, output_apk], check=True)
            return output_apk
        except subprocess.CalledProcessError as e:
            return f"Error: {e}"
        
iface = gr.Interface(
    fn=generate_apk,
    inputs=gr.Textbox(label="PWA Manifest URL"),
    outputs=gr.File(label="Download APK"),
    title="PWA to APK Converter",
    description="Enter the URL to your PWA manifest to generate a signed Android APK using Bubblewrap."
)

if __name__ == "__main__":
    iface.launch()