jykoh commited on
Commit
1841b37
•
1 Parent(s): 5103f57

Fix community button

Browse files
Files changed (2) hide show
  1. app.py +3 -22
  2. share_btn.py +0 -6
app.py CHANGED
@@ -13,25 +13,6 @@ os.environ["HF_HUB_ENABLE_HF_TRANSFER"] = "False"
13
 
14
 
15
  css = """
16
- #share-btn-container {
17
- display: flex; padding-left: 0.5rem !important; padding-right: 0.5rem !important; background-color: #000000; justify-content: center; align-items: center; border-radius: 9999px !important; width: 13rem;
18
- margin-top: 3px;
19
- margin-left: auto;
20
- flex: unset;
21
- }
22
- #share-btn {
23
- all: initial; color: #ffffff;font-weight: 600; cursor:pointer; font-family: 'IBM Plex Sans', sans-serif; margin-left: 0.5rem !important; padding-top: 0.25rem !important; padding-bottom: 0.25rem !important;right:0;
24
- }
25
- #share-btn * {
26
- all: unset;
27
- }
28
- #share-btn-container div:nth-child(-n+2){
29
- width: auto !important;
30
- min-height: 0px !important;
31
- }
32
- #share-btn-container .wrap {
33
- display: none !important;
34
- }
35
  #chatbot { min-height: 300px; }
36
  #save-btn {
37
  background-image: linear-gradient(to right bottom, rgba(130,217,244, 0.9), rgba(158,231,214, 1.0));
@@ -39,10 +20,10 @@ css = """
39
  #save-btn:hover {
40
  background-image: linear-gradient(to right bottom, rgba(110,197,224, 0.9), rgba(138,211,194, 1.0));
41
  }
42
- #share-btn-2 {
43
  background-image: linear-gradient(to right bottom, rgba(130,217,244, 0.9), rgba(158,231,214, 1.0));
44
  }
45
- #share-btn-2:hover {
46
  background-image: linear-gradient(to right bottom, rgba(110,197,224, 0.9), rgba(138,211,194, 1.0));
47
  }
48
  """
@@ -188,7 +169,7 @@ with gr.Blocks(css=css) as demo:
188
  save_button = gr.Button("💾 Save Conversation as .png", elem_id="save-btn")
189
 
190
  with gr.Row(visible=False) as share_group:
191
- share_button = gr.Button("🤗 Share to Community", elem_id="share-btn-2")
192
 
193
 
194
  with gr.Column(scale=0.3, min_width=200):
 
13
 
14
 
15
  css = """
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  #chatbot { min-height: 300px; }
17
  #save-btn {
18
  background-image: linear-gradient(to right bottom, rgba(130,217,244, 0.9), rgba(158,231,214, 1.0));
 
20
  #save-btn:hover {
21
  background-image: linear-gradient(to right bottom, rgba(110,197,224, 0.9), rgba(138,211,194, 1.0));
22
  }
23
+ #share-btn {
24
  background-image: linear-gradient(to right bottom, rgba(130,217,244, 0.9), rgba(158,231,214, 1.0));
25
  }
26
+ #share-btn:hover {
27
  background-image: linear-gradient(to right bottom, rgba(110,197,224, 0.9), rgba(138,211,194, 1.0));
28
  }
29
  """
 
169
  save_button = gr.Button("💾 Save Conversation as .png", elem_id="save-btn")
170
 
171
  with gr.Row(visible=False) as share_group:
172
+ share_button = gr.Button("🤗 Share to Community", elem_id="share-btn")
173
 
174
 
175
  with gr.Column(scale=0.3, min_width=200):
share_btn.py CHANGED
@@ -49,11 +49,7 @@ async () => {
49
  let titleTxt = `FROMAGe`;
50
 
51
  const shareBtnEl = gradioEl.querySelector('#share-btn');
52
- const shareIconEl = gradioEl.querySelector('#share-btn-share-icon');
53
- const loadingIconEl = gradioEl.querySelector('#share-btn-loading-icon');
54
  shareBtnEl.style.pointerEvents = 'none';
55
- shareIconEl.style.display = 'none';
56
- loadingIconEl.style.removeProperty('display');
57
  const descriptionMd = `
58
 
59
  <img src='${urlChatbotImage}'>
@@ -65,8 +61,6 @@ async () => {
65
  const paramsStr = params.toString();
66
  window.open(`https://huggingface.co/spaces/jykoh/fromage/discussions/new?${paramsStr}`, '_blank');
67
  shareBtnEl.style.removeProperty('pointer-events');
68
- shareIconEl.style.removeProperty('display');
69
- loadingIconEl.style.display = 'none';
70
  }
71
  """
72
 
 
49
  let titleTxt = `FROMAGe`;
50
 
51
  const shareBtnEl = gradioEl.querySelector('#share-btn');
 
 
52
  shareBtnEl.style.pointerEvents = 'none';
 
 
53
  const descriptionMd = `
54
 
55
  <img src='${urlChatbotImage}'>
 
61
  const paramsStr = params.toString();
62
  window.open(`https://huggingface.co/spaces/jykoh/fromage/discussions/new?${paramsStr}`, '_blank');
63
  shareBtnEl.style.removeProperty('pointer-events');
 
 
64
  }
65
  """
66