nazdridoy commited on
Commit
bf154be
·
verified ·
1 Parent(s): 0c94952

feat(ui): add chat example prompts and update footer

Browse files

- [docs] Update license text for clarity (README.md:58)
- [docs] Convert various links to markdown format (README.md:61-63)
- [update] Import CHAT_EXAMPLE_PROMPTS (ui_components.py:10)
- [remove] Remove create_chat_tips function call and definition (ui_components.py:78-83, 135-140)
- [feat] Add gr.Examples for chat prompts (ui_components.py:85-89)
- [refactor] Replace detailed quick guide with concise links in create_footer (ui_components.py:742-773)
- [add] Define CHAT_EXAMPLE_PROMPTS list (utils.py:192-204)

Files changed (4) hide show
  1. README.md +4 -4
  2. app.py +2 -3
  3. ui_components.py +18 -63
  4. utils.py +14 -0
README.md CHANGED
@@ -58,12 +58,12 @@ Compatible with providers configured in HF‑Inferoxy, including `auto` (default
58
  - Slow/failures: try smaller models, fewer steps, or another provider.
59
 
60
  ### License
61
- AGPL3.0. See `LICENSE`.
62
 
63
  ### Links
64
- - Live Space: `https://huggingface.co/spaces/nazdridoy/inferoxy-hub`
65
- - HF‑Inferoxy docs: `https://nazdridoy.github.io/hf-inferoxy/`
66
- - Gradio docs: `https://gradio.app/docs/`
67
 
68
  — Built with HF‑Inferoxy for intelligent token management.
69
 
 
58
  - Slow/failures: try smaller models, fewer steps, or another provider.
59
 
60
  ### License
61
+ This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0) - see the [LICENSE](LICENSE) file for details.
62
 
63
  ### Links
64
+ - Live Space: [huggingface.co/spaces/nazdridoy/inferoxy-hub](https://huggingface.co/spaces/nazdridoy/inferoxy-hub)
65
+ - HF‑Inferoxy docs: [nazdridoy.github.io/hf-inferoxy](https://nazdridoy.github.io/hf-inferoxy/)
66
+ - Gradio docs: [gradio.app/docs](https://gradio.app/docs/)
67
 
68
  — Built with HF‑Inferoxy for intelligent token management.
69
 
app.py CHANGED
@@ -28,7 +28,6 @@ def create_app():
28
  # Sidebar with HF OAuth login/logout
29
  with gr.Sidebar():
30
  gr.LoginButton()
31
-
32
  # Main header
33
  create_main_header()
34
 
@@ -48,8 +47,8 @@ def create_app():
48
 
49
  # Text-to-speech tab
50
  create_tts_tab(handle_text_to_speech_generation)
51
-
52
- # Footer with helpful information
53
  create_footer()
54
 
55
  return demo
 
28
  # Sidebar with HF OAuth login/logout
29
  with gr.Sidebar():
30
  gr.LoginButton()
 
31
  # Main header
32
  create_main_header()
33
 
 
47
 
48
  # Text-to-speech tab
49
  create_tts_tab(handle_text_to_speech_generation)
50
+
51
+ # Footer with helpful links
52
  create_footer()
53
 
54
  return demo
ui_components.py CHANGED
@@ -10,7 +10,7 @@ from utils import (
10
  DEFAULT_TTS_MODEL,
11
  CHAT_CONFIG, IMAGE_CONFIG, IMAGE_PROVIDERS,
12
  TTS_VOICES, TTS_MODEL_CONFIGS,
13
- IMAGE_EXAMPLE_PROMPTS, IMAGE_TO_IMAGE_EXAMPLE_PROMPTS, TTS_EXAMPLE_TEXTS, TTS_EXAMPLE_AUDIO_URLS,
14
  DEFAULT_VIDEO_MODEL, VIDEO_EXAMPLE_PROMPTS,
15
  SUGGESTED_CHAT_MODELS, SUGGESTED_IMAGE_MODELS, SUGGESTED_IMAGE_TO_IMAGE_MODELS, SUGGESTED_VIDEO_MODELS
16
  )
@@ -78,8 +78,13 @@ def create_chat_tab(handle_chat_submit_fn, handle_chat_retry_fn=None):
78
  label="Top-p (nucleus sampling)"
79
  )
80
 
81
- # Configuration tips below the chat
82
- create_chat_tips()
 
 
 
 
 
83
 
84
  # Connect chat events (streaming auto-detected from generator function)
85
  # Show stop immediately when sending
@@ -135,35 +140,6 @@ def create_chat_tab(handle_chat_submit_fn, handle_chat_retry_fn=None):
135
  )
136
 
137
 
138
- def create_chat_tips():
139
- """Create the tips section for the chat tab."""
140
- with gr.Row():
141
- with gr.Column():
142
- gr.Markdown("""
143
- ### 💡 Chat Tips
144
-
145
- **Model Format:**
146
- - Model only: `openai/gpt-oss-20b`
147
- - Select provider via the Provider dropdown (default: `auto`)
148
-
149
- **Popular Models:**
150
- - `openai/gpt-oss-20b` - Fast general purpose
151
- - `meta-llama/Llama-2-7b-chat-hf` - Chat optimized
152
- - `microsoft/DialoGPT-medium` - Conversation
153
- - `google/flan-t5-base` - Instruction following
154
- """)
155
-
156
- with gr.Column():
157
- gr.Markdown("""
158
- ### 🚀 Popular Providers
159
-
160
- - Select from dropdown. Default is **auto**.
161
-
162
- **Example:**
163
- - Model: `openai/gpt-oss-20b`, Provider: `groq`
164
- """)
165
-
166
-
167
  def create_image_tab(handle_image_generation_fn):
168
  """
169
  Create the image generation tab interface.
@@ -742,36 +718,15 @@ def create_main_header():
742
 
743
 
744
  def create_footer():
745
- """Create the footer with helpful information."""
746
- gr.Markdown("""
747
- ---
748
- ### 📚 Quick Guide
749
-
750
- **Chat**
751
- - Type a message, pick a model, set provider (defaults to `auto`).
752
- - Tune system message, temperature, top‑p, and max new tokens.
753
-
754
- **Image**
755
- - Write a prompt and select model/provider.
756
- - Optional: width/height (÷8), steps, guidance, seed, negative prompt.
757
-
758
- **Image‑to‑Image**
759
- - Upload an input image and describe the change you want.
760
- - Use the same settings as Image for quality and control.
761
-
762
- **Video**
763
- - Provide a short motion prompt; optionally set steps, guidance, and seed.
764
-
765
- **Text‑to‑Speech**
766
- - Enter text, choose a TTS model, and adjust voice/style if available.
767
-
768
- **Providers**
769
- - Default is `auto`. You can choose from providers available via your HF‑Inferoxy setup.
770
-
771
- **Docs**
772
- - HF‑Inferoxy: https://nazdridoy.github.io/hf-inferoxy/
773
-
774
- Built with HF‑Inferoxy for secure token management and provider routing.
775
- """)
776
 
777
 
 
10
  DEFAULT_TTS_MODEL,
11
  CHAT_CONFIG, IMAGE_CONFIG, IMAGE_PROVIDERS,
12
  TTS_VOICES, TTS_MODEL_CONFIGS,
13
+ CHAT_EXAMPLE_PROMPTS, IMAGE_EXAMPLE_PROMPTS, IMAGE_TO_IMAGE_EXAMPLE_PROMPTS, TTS_EXAMPLE_TEXTS, TTS_EXAMPLE_AUDIO_URLS,
14
  DEFAULT_VIDEO_MODEL, VIDEO_EXAMPLE_PROMPTS,
15
  SUGGESTED_CHAT_MODELS, SUGGESTED_IMAGE_MODELS, SUGGESTED_IMAGE_TO_IMAGE_MODELS, SUGGESTED_VIDEO_MODELS
16
  )
 
78
  label="Top-p (nucleus sampling)"
79
  )
80
 
81
+ # Example prompts for chat
82
+ with gr.Group():
83
+ gr.Markdown("**🌟 Example Prompts**")
84
+ gr.Examples(
85
+ examples=[[p] for p in CHAT_EXAMPLE_PROMPTS],
86
+ inputs=chat_input
87
+ )
88
 
89
  # Connect chat events (streaming auto-detected from generator function)
90
  # Show stop immediately when sending
 
140
  )
141
 
142
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143
  def create_image_tab(handle_image_generation_fn):
144
  """
145
  Create the image generation tab interface.
 
718
 
719
 
720
  def create_footer():
721
+ """Render a simple footer with helpful links."""
722
+ gr.Markdown(
723
+ """
724
+ ---
725
+ ### 🔗 Links
726
+ - **Project repo**: https://github.com/nazdridoy/inferoxy-hub
727
+ - **HF‑Inferoxy docs**: https://nazdridoy.github.io/hf-inferoxy/
728
+ - **License**: https://github.com/nazdridoy/inferoxy-hub/blob/main/LICENSE
729
+ """
730
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
731
 
732
 
utils.py CHANGED
@@ -192,6 +192,20 @@ TTS_VOICES = {
192
  '🇬🇧 🚹 Daniel': 'bm_daniel',
193
  }
194
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
195
  # Example prompts for image generation
196
  IMAGE_EXAMPLE_PROMPTS = [
197
  "A majestic dragon flying over a medieval castle, epic fantasy art, detailed, 8k",
 
192
  '🇬🇧 🚹 Daniel': 'bm_daniel',
193
  }
194
 
195
+ # Example prompts for chat
196
+ CHAT_EXAMPLE_PROMPTS = [
197
+ "What's a polite way to introduce myself at a networking event?",
198
+ "Can you suggest a fun icebreaker question for a group chat?",
199
+ "Explain the concept of entropy in simple terms suitable for a high school student.",
200
+ "Summarize the main differences between classical and operant conditioning.",
201
+ "Is it possible for artificial intelligence to possess consciousness? Discuss briefly.",
202
+ "What does 'the map is not the territory' mean in philosophy?",
203
+ "Write a Python function to reverse a linked list.",
204
+ "How can I optimize a SQL query for faster performance?",
205
+ "Suggest 3 imaginative prompts for generating images of futuristic cities.",
206
+ "Give me 3 creative prompts for generating surreal animal portraits.",
207
+ ]
208
+
209
  # Example prompts for image generation
210
  IMAGE_EXAMPLE_PROMPTS = [
211
  "A majestic dragon flying over a medieval castle, epic fantasy art, detailed, 8k",