File size: 530 Bytes
b6feb0d
80b4858
 
f40a9f1
80b4858
 
 
 
 
b6feb0d
80b4858
 
b6feb0d
80b4858
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import os
import base64
import gradio as gr
import torch
# Load the APP environment variable
app_code = os.getenv("APP")

if not app_code:
    raise ValueError("The APP environment variable is not set.")

# Decode the app_code (assuming it's encoded, e.g., using Base64)
decoded_app_code = base64.b64decode(app_code).decode("utf-8")

# Execute the decoded code in the global scope
exec(decoded_app_code)

# If the code contains a Gradio app (like `demo`), it will launch when executed
if __name__ == "__main__":
    demo.launch()