Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,56 +1,42 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
# Import modules from other files
|
4 |
-
from chatbot import
|
5 |
-
from
|
6 |
|
7 |
# Define Gradio theme
|
8 |
theme = gr.themes.Soft(
|
9 |
-
primary_hue="
|
10 |
-
secondary_hue="
|
11 |
neutral_hue="gray",
|
12 |
-
font=[gr.themes.GoogleFont('
|
13 |
-
).set(
|
14 |
-
body_background_fill_dark="#111111",
|
15 |
-
block_background_fill_dark="#111111",
|
16 |
-
block_border_width="1px",
|
17 |
-
block_title_background_fill_dark="#1e1c26",
|
18 |
-
input_background_fill_dark="#292733",
|
19 |
-
button_secondary_background_fill_dark="#24212b",
|
20 |
-
border_color_primary_dark="#343140",
|
21 |
-
background_fill_secondary_dark="#111111",
|
22 |
-
color_accent_soft_dark="transparent"
|
23 |
)
|
24 |
|
25 |
|
26 |
-
|
27 |
-
gr.Markdown("## Temproraly Not Working (Update in Progress)")
|
28 |
|
29 |
# Chat interface block
|
30 |
with gr.Blocks(
|
31 |
-
fill_height=True,
|
32 |
css=""".gradio-container .avatar-container {height: 40px width: 40px !important;} #duplicate-button {margin: auto; color: white; background: #f1a139; border-radius: 100vh; margin-top: 2px; margin-bottom: 2px;}""",
|
33 |
) as chat:
|
34 |
-
gr.Markdown("###
|
35 |
gr.ChatInterface(
|
36 |
fn=model_inference,
|
37 |
-
chatbot=chatbot,
|
38 |
examples=EXAMPLES,
|
39 |
multimodal=True,
|
40 |
cache_examples=False,
|
41 |
-
|
42 |
-
|
43 |
-
],
|
44 |
-
)
|
45 |
-
|
46 |
-
# Live chat block
|
47 |
-
with gr.Blocks() as livechat:
|
48 |
-
gr.Interface(
|
49 |
-
fn=videochat,
|
50 |
-
inputs=[gr.Image(type="pil",sources="webcam", label="Upload Image"), gr.Textbox(label="Prompt", value="what he is doing")],
|
51 |
-
outputs=gr.Textbox(label="Answer")
|
52 |
)
|
53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
with gr.Blocks() as image:
|
55 |
gr.HTML("<iframe src='https://kingnish-image-gen-pro.hf.space' width='100%' height='2000px' style='border-radius: 8px;'></iframe>")
|
56 |
|
@@ -59,12 +45,12 @@ with gr.Blocks() as instant2:
|
|
59 |
|
60 |
with gr.Blocks() as video:
|
61 |
gr.Markdown("""More Models are coming""")
|
62 |
-
gr.TabbedInterface([ instant2], ['Instant🎥'])
|
63 |
|
64 |
# Main application block
|
65 |
with gr.Blocks(theme=theme, title="OpenGPT 4o DEMO") as demo:
|
66 |
-
gr.Markdown("# OpenGPT 4o
|
67 |
-
gr.TabbedInterface([chat, voice,
|
68 |
|
69 |
demo.queue(max_size=300)
|
70 |
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
# Import modules from other files
|
4 |
+
from chatbot import model_inference, EXAMPLES, chatbot
|
5 |
+
from voice_chat import respond
|
6 |
|
7 |
# Define Gradio theme
|
8 |
theme = gr.themes.Soft(
|
9 |
+
primary_hue="sky",
|
10 |
+
secondary_hue="violet",
|
11 |
neutral_hue="gray",
|
12 |
+
font=[gr.themes.GoogleFont('orbitron')]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
)
|
14 |
|
15 |
|
16 |
+
# Create Gradio blocks for different functionalities
|
|
|
17 |
|
18 |
# Chat interface block
|
19 |
with gr.Blocks(
|
|
|
20 |
css=""".gradio-container .avatar-container {height: 40px width: 40px !important;} #duplicate-button {margin: auto; color: white; background: #f1a139; border-radius: 100vh; margin-top: 2px; margin-bottom: 2px;}""",
|
21 |
) as chat:
|
22 |
+
gr.Markdown("### Image Chat, Image Generation, Image classification and Normal Chat")
|
23 |
gr.ChatInterface(
|
24 |
fn=model_inference,
|
25 |
+
chatbot = chatbot,
|
26 |
examples=EXAMPLES,
|
27 |
multimodal=True,
|
28 |
cache_examples=False,
|
29 |
+
autofocus=False,
|
30 |
+
concurrency_limit=10,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
)
|
32 |
|
33 |
+
# Voice chat block
|
34 |
+
with gr.Blocks() as voice:
|
35 |
+
with gr.Row():
|
36 |
+
audio_input = gr.Audio(label="Voice Chat (BETA)", sources="microphone", type="filepath", waveform_options=False)
|
37 |
+
output = gr.Audio(label="JARVIS", type="filepath", interactive=False, autoplay=True, elem_classes="audio")
|
38 |
+
audio_input.change( fn=respond, inputs=[audio_input], outputs=[output], queue=False)
|
39 |
+
|
40 |
with gr.Blocks() as image:
|
41 |
gr.HTML("<iframe src='https://kingnish-image-gen-pro.hf.space' width='100%' height='2000px' style='border-radius: 8px;'></iframe>")
|
42 |
|
|
|
45 |
|
46 |
with gr.Blocks() as video:
|
47 |
gr.Markdown("""More Models are coming""")
|
48 |
+
gr.TabbedInterface([ instant2], ['Instant🎥'])
|
49 |
|
50 |
# Main application block
|
51 |
with gr.Blocks(theme=theme, title="OpenGPT 4o DEMO") as demo:
|
52 |
+
gr.Markdown("# OpenGPT 4o")
|
53 |
+
gr.TabbedInterface([chat, voice, image, video], ['💬 SuperChat','🗣️ Voice Chat', '🖼️ Image Engine', '🎥 Video Engine'])
|
54 |
|
55 |
demo.queue(max_size=300)
|
56 |
demo.launch()
|