abidlabs HF staff commited on
Commit
0bf5eb4
1 Parent(s): a41f592

Upload folder using huggingface_hub

Browse files
README.md CHANGED
@@ -1,9 +1,9 @@
1
 
2
  ---
3
  tags: [gradio-custom-component,gradio-template-Chatbot]
4
- title: gradio_gptchatbot V0.0.1
5
- colorFrom: indigo
6
- colorTo: pink
7
  sdk: docker
8
  pinned: false
9
  license: apache-2.0
 
1
 
2
  ---
3
  tags: [gradio-custom-component,gradio-template-Chatbot]
4
+ title: gradio_gptchatbot V0.0.2
5
+ colorFrom: red
6
+ colorTo: red
7
  sdk: docker
8
  pinned: false
9
  license: apache-2.0
__pycache__/app.cpython-311.pyc CHANGED
Binary files a/__pycache__/app.cpython-311.pyc and b/__pycache__/app.cpython-311.pyc differ
 
app.py CHANGED
@@ -10,7 +10,7 @@ example = [
10
 
11
  with gr.Blocks() as demo:
12
  with gr.Row():
13
- GPTChatbot(label="Blank"), # blank component
14
  GPTChatbot(value=example, label="Populated", layout="panel"), # populated component
15
 
16
 
 
10
 
11
  with gr.Blocks() as demo:
12
  with gr.Row():
13
+ GPTChatbot(label="Blank", placeholder_title="GradioGPT", placeholder_image="https://i.ibb.co/H2kSY2R/Gradio-component-1.png"), # blank component
14
  GPTChatbot(value=example, label="Populated", layout="panel"), # populated component
15
 
16
 
requirements.txt CHANGED
@@ -1 +1 @@
1
- gradio_gptchatbot-0.0.1-py3-none-any.whl
 
1
+ gradio_gptchatbot-0.0.2-py3-none-any.whl
src/backend/gradio_gptchatbot/gptchatbot.py CHANGED
@@ -68,6 +68,8 @@ class GPTChatbot(Component):
68
  line_breaks: bool = True,
69
  likeable: bool = False,
70
  layout: Literal["panel", "bubble"] | None = None,
 
 
71
  ):
72
  """
73
  Parameters:
@@ -126,13 +128,17 @@ class GPTChatbot(Component):
126
  value=value,
127
  )
128
  self.avatar_images: list[str | None] = [None, None]
129
- if avatar_images is None:
130
- pass
131
- else:
132
  self.avatar_images = [
133
  processing_utils.move_resource_to_block_cache(avatar_images[0], self),
134
  processing_utils.move_resource_to_block_cache(avatar_images[1], self),
135
  ]
 
 
 
 
 
 
136
 
137
  def _preprocess_chat_messages(
138
  self, chat_message: str | FileMessage | None
 
68
  line_breaks: bool = True,
69
  likeable: bool = False,
70
  layout: Literal["panel", "bubble"] | None = None,
71
+ placeholder_image: str | Path | None = None,
72
+ placeholder_title: str | None = None,
73
  ):
74
  """
75
  Parameters:
 
128
  value=value,
129
  )
130
  self.avatar_images: list[str | None] = [None, None]
131
+ if avatar_images is not None:
 
 
132
  self.avatar_images = [
133
  processing_utils.move_resource_to_block_cache(avatar_images[0], self),
134
  processing_utils.move_resource_to_block_cache(avatar_images[1], self),
135
  ]
136
+ self.placeholder_image = None
137
+ if placeholder_image is not None:
138
+ self.placeholder_image = processing_utils.move_resource_to_block_cache(
139
+ placeholder_image, self
140
+ )
141
+ self.placeholder_title = placeholder_title
142
 
143
  def _preprocess_chat_messages(
144
  self, chat_message: str | FileMessage | None
src/backend/gradio_gptchatbot/gptchatbot.pyi CHANGED
@@ -76,6 +76,8 @@ class GPTChatbot(Component):
76
  line_breaks: bool = True,
77
  likeable: bool = False,
78
  layout: Literal["panel", "bubble"] | None = None,
 
 
79
  ):
80
  """
81
  Parameters:
@@ -134,13 +136,17 @@ class GPTChatbot(Component):
134
  value=value,
135
  )
136
  self.avatar_images: list[str | None] = [None, None]
137
- if avatar_images is None:
138
- pass
139
- else:
140
  self.avatar_images = [
141
  processing_utils.move_resource_to_block_cache(avatar_images[0], self),
142
  processing_utils.move_resource_to_block_cache(avatar_images[1], self),
143
  ]
 
 
 
 
 
 
144
 
145
  def _preprocess_chat_messages(
146
  self, chat_message: str | FileMessage | None
 
76
  line_breaks: bool = True,
77
  likeable: bool = False,
78
  layout: Literal["panel", "bubble"] | None = None,
79
+ placeholder_image: str | Path | None = None,
80
+ placeholder_title: str | None = None,
81
  ):
82
  """
83
  Parameters:
 
136
  value=value,
137
  )
138
  self.avatar_images: list[str | None] = [None, None]
139
+ if avatar_images is not None:
 
 
140
  self.avatar_images = [
141
  processing_utils.move_resource_to_block_cache(avatar_images[0], self),
142
  processing_utils.move_resource_to_block_cache(avatar_images[1], self),
143
  ]
144
+ self.placeholder_image = None
145
+ if placeholder_image is not None:
146
+ self.placeholder_image = processing_utils.move_resource_to_block_cache(
147
+ placeholder_image, self
148
+ )
149
+ self.placeholder_title = placeholder_title
150
 
151
  def _preprocess_chat_messages(
152
  self, chat_message: str | FileMessage | None
src/backend/gradio_gptchatbot/templates/component/index.js CHANGED
The diff for this file is too large to render. See raw diff
 
src/backend/gradio_gptchatbot/templates/component/style.css CHANGED
The diff for this file is too large to render. See raw diff
 
src/demo/app.py CHANGED
@@ -10,7 +10,7 @@ example = [
10
 
11
  with gr.Blocks() as demo:
12
  with gr.Row():
13
- GPTChatbot(label="Blank"), # blank component
14
  GPTChatbot(value=example, label="Populated", layout="panel"), # populated component
15
 
16
 
 
10
 
11
  with gr.Blocks() as demo:
12
  with gr.Row():
13
+ GPTChatbot(label="Blank", placeholder_title="GradioGPT", placeholder_image="https://i.ibb.co/H2kSY2R/Gradio-component-1.png"), # blank component
14
  GPTChatbot(value=example, label="Populated", layout="panel"), # populated component
15
 
16
 
src/frontend/Index.svelte CHANGED
@@ -48,6 +48,8 @@
48
  like: LikeData;
49
  }>;
50
  export let avatar_images: [string | null, string | null] = [null, null];
 
 
51
 
52
  let _value: [
53
  string | { file: FileData; alt_text: string | null } | null,
@@ -136,6 +138,8 @@
136
  {layout}
137
  {proxy_url}
138
  {root}
 
 
139
  />
140
  </div>
141
  </Block>
 
48
  like: LikeData;
49
  }>;
50
  export let avatar_images: [string | null, string | null] = [null, null];
51
+ export let placeholder_image: string | null = null;
52
+ export let placeholder_title: string | null = null;
53
 
54
  let _value: [
55
  string | { file: FileData; alt_text: string | null } | null,
 
138
  {layout}
139
  {proxy_url}
140
  {root}
141
+ {placeholder_image}
142
+ {placeholder_title}
143
  />
144
  </div>
145
  </Block>
src/frontend/shared/ChatBot.svelte CHANGED
@@ -45,6 +45,8 @@
45
  export let proxy_url: null | string;
46
  export let i18n: I18nFormatter;
47
  export let layout: "bubble" | "panel" = "bubble";
 
 
48
 
49
  let div: HTMLDivElement;
50
  let autoscroll: boolean;
@@ -136,19 +138,31 @@
136
  aria-label="chatbot conversation"
137
  aria-live="polite"
138
  >
139
- <div class="logo-container">
140
- <img class="centered-logo" src="https://raw.githubusercontent.com/gradio-app/gradio/main/js/_website/static/favicon.png" alt="Chatbot Logo" />
 
 
 
 
 
 
 
 
 
141
  </div>
142
- <p class="placeholder-text">How can I help you today?</p>
 
 
 
143
  <div class="message-wrap" class:bubble-gap={layout === "bubble"} use:copy>
144
  <!-- Existing message elements -->
145
  </div>
146
- <div class="buttons-container">
147
  <button class="action-button">Plan a trip</button>
148
  <button class="action-button">Brainstorm names</button>
149
  <button class="action-button">Write a spreadsheet formula</button>
150
  <button class="action-button">Create a charter</button>
151
- </div>
152
  </div>
153
 
154
  {:else}
@@ -580,14 +594,15 @@
580
  }
581
 
582
  .centered-logo {
583
- max-width: 150px; /* Adjust as needed */
584
  margin: 0 auto;
585
  }
586
 
587
  .placeholder-text {
588
  text-align: center;
589
- color: #666; /* Placeholder text color */
590
  font-size: large;
 
591
  margin-bottom: 20px;
592
  }
593
 
 
45
  export let proxy_url: null | string;
46
  export let i18n: I18nFormatter;
47
  export let layout: "bubble" | "panel" = "bubble";
48
+ export let placeholder_image: string | null = null;
49
+ export let placeholder_title: string | null = null;
50
 
51
  let div: HTMLDivElement;
52
  let autoscroll: boolean;
 
138
  aria-label="chatbot conversation"
139
  aria-live="polite"
140
  >
141
+ {#if placeholder_image}
142
+ <div class="logo-container">
143
+ <img
144
+ class="centered-logo"
145
+ src={get_fetchable_url_or_file(
146
+ placeholder_image,
147
+ root,
148
+ proxy_url
149
+ )}
150
+ alt="logo"
151
+ />
152
  </div>
153
+ {/if}
154
+ {#if placeholder_title}
155
+ <p class="placeholder-text">{placeholder_title}</p>
156
+ {/if}
157
  <div class="message-wrap" class:bubble-gap={layout === "bubble"} use:copy>
158
  <!-- Existing message elements -->
159
  </div>
160
+ <!-- <div class="buttons-container">
161
  <button class="action-button">Plan a trip</button>
162
  <button class="action-button">Brainstorm names</button>
163
  <button class="action-button">Write a spreadsheet formula</button>
164
  <button class="action-button">Create a charter</button>
165
+ </div> -->
166
  </div>
167
 
168
  {:else}
 
594
  }
595
 
596
  .centered-logo {
597
+ max-width: 100px !important;
598
  margin: 0 auto;
599
  }
600
 
601
  .placeholder-text {
602
  text-align: center;
603
+ color: black; /* Placeholder text color */
604
  font-size: large;
605
+ font-weight: bold;
606
  margin-bottom: 20px;
607
  }
608
 
src/pyproject.toml CHANGED
@@ -8,7 +8,7 @@ build-backend = "hatchling.build"
8
 
9
  [project]
10
  name = "gradio_gptchatbot"
11
- version = "0.0.1"
12
  description = "Python library for easily interacting with trained machine learning models"
13
  readme = "README.md"
14
  license = "Apache-2.0"
@@ -39,7 +39,7 @@ classifiers = [
39
  dev = ["build", "twine"]
40
 
41
  [tool.hatch.build]
42
- artifacts = ["/backend/gradio_gptchatbot/templates", "*.pyi", "backend/gradio_gptchatbot/templates"]
43
 
44
  [tool.hatch.build.targets.wheel]
45
  packages = ["/backend/gradio_gptchatbot"]
 
8
 
9
  [project]
10
  name = "gradio_gptchatbot"
11
+ version = "0.0.2"
12
  description = "Python library for easily interacting with trained machine learning models"
13
  readme = "README.md"
14
  license = "Apache-2.0"
 
39
  dev = ["build", "twine"]
40
 
41
  [tool.hatch.build]
42
+ artifacts = ["/backend/gradio_gptchatbot/templates", "*.pyi", "backend/gradio_gptchatbot/templates", "backend/gradio_gptchatbot/templates"]
43
 
44
  [tool.hatch.build.targets.wheel]
45
  packages = ["/backend/gradio_gptchatbot"]