File size: 1,166 Bytes
042b200
8f7f52e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
import requests

# Backend URL (Replit link डालना यहाँ)
BACKEND_URL = "https://luminoid-backend.repl.co/chat"

# Chat handler
def handle_chat(message, history):
    payload = {
        "message": message,
        "history": history
    }

    try:
        response = requests.post(BACKEND_URL, json=payload)
        result = response.json()

        if result["type"] == "text":
            return result["response"]
        elif result["type"] == "image":
            return (result["response"],)
        elif result["type"] == "video":
            return (result["response"],)
        elif result["type"] == "error":
            return result["response"]
    except Exception as e:
        return f"❌ Error: {str(e)}"

# Chat Interface
chat = gr.ChatInterface(
    fn=handle_chat,
    title="🤖 Luminoid AI Chat",
    description="Text, Image और Video – सब कुछ एक ही Chat में!",
    examples=[
        "Mujhe ek black dog ki image do",
        "Ek cartoon hero ka image banao",
        "Is image se ek video banao",
        "Bhai meri madad karo problem solve karne me"
    ]
)

chat.launch()