KingNish commited on
Commit
954f085
1 Parent(s): 3dff02c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +60 -22
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="sky",
9
- secondary_hue="violet",
10
- neutral_hue="gray",
11
- font=[gr.themes.GoogleFont('orbitron')]
12
  )
13
 
14
-
15
- # Create Gradio blocks for different functionalities
16
-
17
  # Chat interface block
18
- with gr.Blocks(
19
- 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;}""",
20
- ) as chat:
21
- gr.Markdown("### Image Chat, Image Generation, Image classification and Normal Chat")
22
  gr.ChatInterface(
23
  fn=model_inference,
24
- chatbot = 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("# Try Voice Chatfrom Below Link:")
35
- gr.HTML("<a href='https://huggingface.co/spaces/KingNish/Voicee'>https://huggingface.co/spaces/KingNish/Voicee</a>")
 
36
 
 
37
  with gr.Blocks() as image:
38
- gr.HTML("<iframe src='https://kingnish-image-gen-pro.hf.space' width='100%' height='2000px' style='border-radius: 8px;'></iframe>")
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("""More Models are coming""")
45
- gr.TabbedInterface([ instant2], ['Instant🎥'])
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([chat, voice, image, video], ['💬 SuperChat','🗣️ Voice Chat', '🖼️ Image Engine', '🎥 Video Engine'])
 
 
 
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()