Spaces:
Sleeping
Sleeping
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() |