Taf2023 commited on
Commit
d475e29
·
verified ·
1 Parent(s): f3bc981

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -0
app.py CHANGED
@@ -1,8 +1,42 @@
1
  import subprocess
2
  import gradio as gr
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
 
4
  def build_android_app(app_name, package_name, website_url, app_logo):
5
  try:
 
 
 
 
6
  # Create a new Android app
7
  subprocess.check_call(["flutter", "create", app_name])
8
 
 
1
  import subprocess
2
  import gradio as gr
3
+ import platform
4
+ import os
5
+
6
+ def install_flutter():
7
+ if platform.system() == "Windows":
8
+ # Download the Flutter installation bundle
9
+ subprocess.check_call(["powershell", "curl", "-o", "flutter_windows_stable.zip", "https://storage.googleapis.com/flutter_infra/releases/stable/windows/flutter_windows_stable.zip"])
10
+
11
+ # Extract the zip file
12
+ subprocess.check_call(["powershell", "Expand-Archive", "-Path", "flutter_windows_stable.zip", "-DestinationPath", "C:\\src\\flutter"])
13
+
14
+ # Update the system's PATH environment variable
15
+ subprocess.check_call(["powershell", "setx", "PATH", "%PATH%;C:\\src\\flutter\\bin"])
16
+
17
+ elif platform.system() == "Darwin": # macOS
18
+ # Install Flutter using Homebrew
19
+ subprocess.check_call(["brew", "install", "--cask", "flutter"])
20
+
21
+ elif platform.system() == "Linux":
22
+ # Download the Flutter installation bundle
23
+ subprocess.check_call(["wget", "https://storage.googleapis.com/flutter_infra/releases/stable/linux/flutter_linux_stable.tar.xz"])
24
+
25
+ # Extract the tar file
26
+ subprocess.check_call(["tar", "xvf", "flutter_linux_stable.tar.xz", "-C", "~/development/"])
27
+
28
+ # Update the system's PATH environment variable
29
+ with open(os.path.expanduser("~/.bashrc"), "a") as f:
30
+ f.write("export PATH=$PATH:~/development/flutter/bin")
31
+
32
+ subprocess.check_call(["source", "~/.bashrc"])
33
 
34
  def build_android_app(app_name, package_name, website_url, app_logo):
35
  try:
36
+ # Install Flutter if it's not already installed
37
+ if not subprocess.check_output(["which", "flutter"]).decode("utf-8"):
38
+ install_flutter()
39
+
40
  # Create a new Android app
41
  subprocess.check_call(["flutter", "create", app_name])
42