Spaces:
Paused
Paused
File size: 1,171 Bytes
c20c8a4 c87fca9 c20c8a4 82ac893 97558f3 c87fca9 c20c8a4 c87fca9 97558f3 c87fca9 82ac893 c87fca9 c20c8a4 |
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 27 28 29 30 31 |
import gradio as gr
import requests
PORTED_SERVER_URL = "http://192.168.1.100:5000/upload"
def convert_exe_to_apk(file_path):
try:
with open(file_path, "rb") as f:
files = {"file": f}
response = requests.post(PORTED_SERVER_URL, files=files)
if response.status_code == 200:
apk_url = response.json().get("apk_url", None)
if apk_url:
return apk_url, gr.update(visible=True) # Show the button
else:
return f"❌ Server Error: {response.json().get('error', 'Unknown Error')}", gr.update(visible=False)
except Exception as e:
return f"❌ Failed to upload: {str(e)}", gr.update(visible=False)
with gr.Blocks() as app:
gr.Markdown("## EXE to APK Converter")
upload_button = gr.File(label="Upload EXE File", type="filepath") # ✅ Corrected type
output_text = gr.Textbox(label="Download Link", interactive=False) # Shows the URL
download_button = gr.Button("Download APK", visible=False) # Initially hidden
upload_button.change(convert_exe_to_apk, inputs=upload_button, outputs=[output_text, download_button])
app.launch()
|