Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -3,51 +3,89 @@ import spaces
|
|
3 |
from chatbot import model_inference, EXAMPLES, chatbot
|
4 |
from voice_chat import respond
|
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
# Define Gradio theme
|
7 |
theme = gr.themes.Soft(
|
8 |
-
primary_hue="
|
9 |
-
secondary_hue="
|
10 |
-
neutral_hue="
|
11 |
-
font=[gr.themes.GoogleFont('
|
12 |
)
|
13 |
|
14 |
-
|
15 |
-
# Create Gradio blocks for different functionalities
|
16 |
-
|
17 |
# Chat interface block
|
18 |
-
with gr.Blocks(
|
19 |
-
|
20 |
-
) as chat:
|
21 |
-
gr.Markdown("### Image Chat, Image Generation, Image classification and Normal Chat")
|
22 |
gr.ChatInterface(
|
23 |
fn=model_inference,
|
24 |
-
chatbot
|
25 |
examples=EXAMPLES,
|
26 |
multimodal=True,
|
27 |
cache_examples=False,
|
28 |
autofocus=False,
|
29 |
concurrency_limit=10,
|
|
|
30 |
)
|
31 |
|
32 |
# Voice chat block
|
33 |
with gr.Blocks() as voice:
|
34 |
-
gr.Markdown("
|
35 |
-
gr.
|
|
|
36 |
|
|
|
37 |
with gr.Blocks() as image:
|
38 |
-
gr.
|
39 |
-
|
40 |
-
with gr.Blocks() as instant2:
|
41 |
-
gr.HTML("<iframe src='https://kingnish-instant-video.hf.space' width='100%' height='3000px' style='border-radius: 8px;'></iframe>")
|
42 |
|
|
|
43 |
with gr.Blocks() as video:
|
44 |
-
gr.Markdown("
|
45 |
-
gr.
|
46 |
|
47 |
# Main application block
|
48 |
with gr.Blocks(theme=theme, title="OpenGPT 4o DEMO") as demo:
|
49 |
-
gr.Markdown("# OpenGPT 4o")
|
50 |
-
gr.TabbedInterface(
|
|
|
|
|
|
|
51 |
|
52 |
demo.queue(max_size=300)
|
53 |
demo.launch()
|
|
|
3 |
from chatbot import model_inference, EXAMPLES, chatbot
|
4 |
from voice_chat import respond
|
5 |
|
6 |
+
# Define custom CSS for better styling
|
7 |
+
custom_css = """
|
8 |
+
.gradio-container {
|
9 |
+
font-family: 'Roboto', sans-serif;
|
10 |
+
}
|
11 |
+
|
12 |
+
.main-header {
|
13 |
+
text-align: center;
|
14 |
+
color: #4a4a4a;
|
15 |
+
margin-bottom: 2rem;
|
16 |
+
}
|
17 |
+
|
18 |
+
.tab-header {
|
19 |
+
font-size: 1.2rem;
|
20 |
+
font-weight: bold;
|
21 |
+
margin-bottom: 1rem;
|
22 |
+
}
|
23 |
+
|
24 |
+
.custom-chatbot {
|
25 |
+
border-radius: 10px;
|
26 |
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
27 |
+
}
|
28 |
+
|
29 |
+
.custom-button {
|
30 |
+
background-color: #3498db;
|
31 |
+
color: white;
|
32 |
+
border: none;
|
33 |
+
padding: 10px 20px;
|
34 |
+
border-radius: 5px;
|
35 |
+
cursor: pointer;
|
36 |
+
transition: background-color 0.3s ease;
|
37 |
+
}
|
38 |
+
|
39 |
+
.custom-button:hover {
|
40 |
+
background-color: #2980b9;
|
41 |
+
}
|
42 |
+
"""
|
43 |
+
|
44 |
# Define Gradio theme
|
45 |
theme = gr.themes.Soft(
|
46 |
+
primary_hue="indigo",
|
47 |
+
secondary_hue="blue",
|
48 |
+
neutral_hue="slate",
|
49 |
+
font=[gr.themes.GoogleFont('Roboto'), "sans-serif"]
|
50 |
)
|
51 |
|
|
|
|
|
|
|
52 |
# Chat interface block
|
53 |
+
with gr.Blocks(css=custom_css) as chat:
|
54 |
+
gr.Markdown("### 💬 OpenGPT 4o Chat", elem_classes="tab-header")
|
|
|
|
|
55 |
gr.ChatInterface(
|
56 |
fn=model_inference,
|
57 |
+
chatbot=chatbot,
|
58 |
examples=EXAMPLES,
|
59 |
multimodal=True,
|
60 |
cache_examples=False,
|
61 |
autofocus=False,
|
62 |
concurrency_limit=10,
|
63 |
+
elem_classes="custom-chatbot"
|
64 |
)
|
65 |
|
66 |
# Voice chat block
|
67 |
with gr.Blocks() as voice:
|
68 |
+
gr.Markdown("### 🗣️ Voice Chat", elem_classes="tab-header")
|
69 |
+
gr.Markdown("Try Voice Chat from the link below:")
|
70 |
+
gr.HTML('<a href="https://huggingface.co/spaces/KingNish/Voicee" target="_blank" class="custom-button">Open Voice Chat</a>')
|
71 |
|
72 |
+
# Image engine block
|
73 |
with gr.Blocks() as image:
|
74 |
+
gr.Markdown("### 🖼️ Image Engine", elem_classes="tab-header")
|
75 |
+
gr.Markdown("Image processing features coming soon!")
|
|
|
|
|
76 |
|
77 |
+
# Video engine block
|
78 |
with gr.Blocks() as video:
|
79 |
+
gr.Markdown("### 🎥 Video Engine", elem_classes="tab-header")
|
80 |
+
gr.Markdown("Video processing features coming soon!")
|
81 |
|
82 |
# Main application block
|
83 |
with gr.Blocks(theme=theme, title="OpenGPT 4o DEMO") as demo:
|
84 |
+
gr.Markdown("# 🚀 OpenGPT 4o", elem_classes="main-header")
|
85 |
+
gr.TabbedInterface(
|
86 |
+
[chat, voice, image, video],
|
87 |
+
['💬 SuperChat', '🗣️ Voice Chat', '🖼️ Image Engine', '🎥 Video Engine']
|
88 |
+
)
|
89 |
|
90 |
demo.queue(max_size=300)
|
91 |
demo.launch()
|