File size: 2,146 Bytes
df83e9f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
                vibrant_btn = gr.Button("🌈 Vibrant") 
                street_btn = gr.Button("πŸ“Έ Street")
            
            # Event handlers
            analyze_btn.click(
                fn=self.analyze_image_with_groq,
                inputs=[input_image],
                outputs=[prompt]
            )
            
            portrait_btn.click(
                lambda: "artistic lifestyle portrait, person with expressive face, vibrant clothing, golden hour lighting",
                outputs=[prompt]
            )
            
            vibrant_btn.click(
                lambda: "person in colorful streetwear, vibrant orange bucket hat, street photography, film aesthetic",
                outputs=[prompt]
            )
            
            street_btn.click(
                lambda: "urban street style portrait, candid expression, natural lighting, contemporary photography",
                outputs=[prompt]
            )
            
            generate_btn.click(
                fn=self.generate_image,
                inputs=[prompt, model_choice, lora_choice, steps, guidance, seed],
                outputs=[output_image, status]
            )
        
        return interface
    
    def launch(self):
        """Launch complete interface"""
        interface = self.create_interface()
        
        port = find_free_port()
        print("🏠 Launching Complete Local Flux Studio...")
        print(f"πŸ“± Interface: http://localhost:{port}")
        print("πŸš€ Using maximum local resources!")
        
        try:
            interface.launch(
                server_port=port,
                share=False,
                inbrowser=True
            )
        except Exception as e:
            print(f"❌ Launch failed: {e}")

if __name__ == "__main__":
    # Check if sentencepiece is installed
    try:
        import sentencepiece
        print("βœ… SentencePiece found")
    except ImportError:
        print("❌ SentencePiece not found")
        print("πŸ”§ Install with: pip install sentencepiece protobuf")
        exit(1)
    
    interface = CompleteLocalFlux()
    interface.launch()