File size: 3,781 Bytes
aa85d13
4375810
9f6025c
4375810
9f6025c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4375810
aa85d13
9f6025c
 
 
 
 
 
 
 
 
 
 
aa85d13
 
 
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# app.py
import gradio as gr
from transformers import pipeline

# =============================
# LOAD YOUR MODELS
# =============================

# ----- Text models -----
text_models = [
    pipeline("text-generation", model="openai/gpt-oss-120b"),
    pipeline("text-generation", model="deepseek-ai/DeepSeek-V3.1-Base"),
    pipeline("text-generation", model="zai-org/GLM-4.5"),
    pipeline("text-generation", model="zai-org/chatglm3-6b"),
    pipeline("text-generation", model="openai/gpt-oss-20b")
]

# ----- Audio models -----
tts_models = [
    pipeline("text-to-speech", model="sk0032/coqui-tts-model"),
    pipeline("text-to-speech", model="sysf/Edge-TTS")
]

# ----- Whisper ASR -----
speech_to_text_model = pipeline("automatic-speech-recognition", model="openai/whisper-large-v3-turbo")

# ----- Image models -----
image_models = [
    pipeline("text-to-image", model="GD-ML/USP-Image_Generation"),
    pipeline("text-to-image", model="Qwen/Qwen-Image"),
    pipeline("text-to-image", model="Comfy-Org/Qwen-Image-DiffSynth-ControlNets"),
    pipeline("image-to-text", model="Salesforce/blip2-opt-2.7b"),
    pipeline("vision-to-text", model="Vision-CAIR/MiniGPT-4")
]

# ----- Video models -----
video_models = [
    pipeline("text-to-video", model="sudip1987/Generate_videos_with_Veo3"),
    pipeline("text-to-video", model="ali-vilab/text-to-video-ms-1.7b")
]

# ----- Music model -----
music_model = pipeline("text-to-music", model="sander-wood/text-to-music")

# =============================
# HELPER FUNCTIONS
# =============================

def merge_text_models(prompt):
    responses = []
    for model in text_models:
        try:
            out = model(prompt)[0]['generated_text']
            responses.append(out)
        except Exception as e:
            responses.append(f"[Model failed: {str(e)}]")
    return "\n---\n".join(responses)

def generate_audio(text):
    audio_files = []
    for model in tts_models:
        try:
            audio_path = model(text)
            audio_files.append(audio_path)
        except Exception as e:
            audio_files.append(None)
    return audio_files[0] if audio_files else None

def generate_images(text):
    imgs = []
    for model in image_models:
        try:
            img = model(text)[0]['image']
            imgs.append(img)
        except Exception as e:
            continue
    return imgs[:3]  # Show top 3 images

def generate_videos(text):
    vids = []
    for model in video_models:
        try:
            vid = model(text)
            vids.append(vid)
        except Exception as e:
            continue
    return vids[:1]  # Show one video

# =============================
# MAIN ARK-AI FUNCTION
# =============================

def ark_ai_main(prompt):
    # Text
    text_output = merge_text_models(prompt)
    
    # Inject personality
    personality = "ARK-AI (fun, savage, chaotic-good) says:\n"
    full_text = personality + text_output
    
    # Media
    image_output = generate_images(prompt)
    video_output = generate_videos(prompt)
    audio_output = generate_audio(prompt)
    
    return full_text, image_output, video_output, audio_output

# =============================
# GRADIO INTERFACE
# =============================

iface = gr.Interface(
    fn=ark_ai_main,
    inputs=gr.Textbox(lines=3, placeholder="Ask ARK-AI anything..."),
    outputs=[
        gr.Textbox(label="ARK-AI Text Response"),
        gr.Gallery(label="Images Generated"),
        gr.Video(label="Video Generated"),
        gr.Audio(label="Audio Response")
    ],
    title="ARK-AI Multi-Modal Assistant",
    description="ARK-AI: Savage, funny, chaotic-good AI assistant merging text, image, audio, and video models.",
    css="styles.css"  # Optional: liquid-glass UI
)

iface.launch()