File size: 732 Bytes
b1d31cc
98605c5
b1d31cc
98605c5
c232276
98605c5
b1d31cc
98605c5
 
 
b1d31cc
 
98605c5
 
 
b1d31cc
 
98605c5
b1d31cc
 
 
 
 
 
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
# app.py
import os

from flux_app.frontend import Frontend
from flux_app.backend import ModelManager

def main():
    # Get the Hugging Face token from an environment variable
    hf_token = os.environ.get("HF_TOKEN")
    if not hf_token:
        raise ValueError("Hugging Face token (HF_TOKEN) not found in environment variables. Please set it.")
        
    model_manager = ModelManager(hf_token=hf_token)
    frontend = Frontend(model_manager)
    app = frontend.create_ui()

    # Enable request queuing. (No extra keyword arguments here.)
    app.queue()

    # Launch the app with the specified server configuration.
    app.launch(server_name="0.0.0.0", server_port=7860, share=False)

if __name__ == "__main__":
    main()