Mrbhupendersingh82 commited on
Commit
042b200
·
verified ·
1 Parent(s): 1eeb699

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +49 -0
app.py ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ # 1) Text to Image dummy fn
4
+ def text_to_image(prompt):
5
+ return "https://placehold.co/512x512?text=Image"
6
+
7
+ # 2) Text to Video dummy fn
8
+ def text_to_video(prompt):
9
+ return "https://sample-videos.com/video123/mp4/720/big_buck_bunny_720p_1mb.mp4"
10
+
11
+ # 3) Image to Video dummy fn
12
+ def image_to_video(image):
13
+ return "https://sample-videos.com/video123/mp4/720/big_buck_bunny_720p_1mb.mp4"
14
+
15
+ # 4) AI Chat dummy fn
16
+ def chat_fn(message, history):
17
+ history = history or []
18
+ history.append((message, "This is AI's reply."))
19
+ return history, history
20
+
21
+ # Tabs definition
22
+ with gr.Blocks(theme=gr.themes.Soft()) as demo:
23
+ gr.Markdown("<h1 style='text-align: center;'>Luminoid AI - Image, Video & Chat</h1>")
24
+
25
+ with gr.Tab("Text to Image"):
26
+ prompt = gr.Textbox(label="Enter prompt")
27
+ output_img = gr.Image()
28
+ btn_img = gr.Button("Generate Image")
29
+ btn_img.click(fn=text_to_image, inputs=prompt, outputs=output_img)
30
+
31
+ with gr.Tab("Text to Video"):
32
+ prompt_vid = gr.Textbox(label="Enter prompt")
33
+ output_vid = gr.Video()
34
+ btn_vid = gr.Button("Generate Video")
35
+ btn_vid.click(fn=text_to_video, inputs=prompt_vid, outputs=output_vid)
36
+
37
+ with gr.Tab("Image to Video"):
38
+ input_img = gr.Image(label="Upload image")
39
+ output_vid2 = gr.Video()
40
+ btn_imgvid = gr.Button("Convert to Video")
41
+ btn_imgvid.click(fn=image_to_video, inputs=input_img, outputs=output_vid2)
42
+
43
+ with gr.Tab("AI Chat"):
44
+ chatbot = gr.Chatbot()
45
+ msg = gr.Textbox(label="Type your message")
46
+ btn_chat = gr.Button("Send")
47
+ btn_chat.click(fn=chat_fn, inputs=[msg, chatbot], outputs=[chatbot, chatbot])
48
+
49
+ demo.launch()