aliabid94 HF staff commited on
Commit
797f2cf
1 Parent(s): 8f53fb5

Upload folder using huggingface_hub

Browse files
Dockerfile CHANGED
@@ -7,7 +7,7 @@ COPY --link --chown=1000 . .
7
 
8
  RUN mkdir -p /tmp/cache/
9
  RUN chmod a+rwx -R /tmp/cache/
10
- ENV TRANSFORMERS_CACHE=/tmp/cache/
11
 
12
  RUN pip install --no-cache-dir -r requirements.txt
13
 
 
7
 
8
  RUN mkdir -p /tmp/cache/
9
  RUN chmod a+rwx -R /tmp/cache/
10
+ ENV TRANSFORMERS_CACHE=/tmp/cache/
11
 
12
  RUN pip install --no-cache-dir -r requirements.txt
13
 
README.md CHANGED
@@ -2,8 +2,8 @@
2
  ---
3
  tags: [gradio-custom-component,gradio-template-Column,Modal, Popup]
4
  title: gradio_modal V0.0.2
5
- colorFrom: gray
6
- colorTo: indigo
7
  sdk: docker
8
  pinned: false
9
  license: apache-2.0
 
2
  ---
3
  tags: [gradio-custom-component,gradio-template-Column,Modal, Popup]
4
  title: gradio_modal V0.0.2
5
+ colorFrom: red
6
+ colorTo: yellow
7
  sdk: docker
8
  pinned: false
9
  license: apache-2.0
app.py CHANGED
@@ -7,6 +7,7 @@ with gr.Blocks() as demo:
7
  text_2 = gr.Textbox(label="Input 2")
8
  text_1.submit(lambda x:x, text_1, text_2)
9
  show_btn = gr.Button("Show Modal")
 
10
  gr.Examples(
11
  [["Text 1", "Text 2"], ["Text 3", "Text 4"]],
12
  inputs=[text_1, text_2],
@@ -14,8 +15,13 @@ with gr.Blocks() as demo:
14
  with gr.Tab("Tab 2"):
15
  gr.Markdown("This is tab 2")
16
  with Modal(visible=False) as modal:
17
- gr.Markdown("Hello world!")
 
 
 
 
18
  show_btn.click(lambda: Modal(visible=True), None, modal)
 
19
 
20
  if __name__ == "__main__":
21
  demo.launch()
 
7
  text_2 = gr.Textbox(label="Input 2")
8
  text_1.submit(lambda x:x, text_1, text_2)
9
  show_btn = gr.Button("Show Modal")
10
+ show_btn2 = gr.Button("Show Modal 2")
11
  gr.Examples(
12
  [["Text 1", "Text 2"], ["Text 3", "Text 4"]],
13
  inputs=[text_1, text_2],
 
15
  with gr.Tab("Tab 2"):
16
  gr.Markdown("This is tab 2")
17
  with Modal(visible=False) as modal:
18
+ for i in range(5):
19
+ gr.Markdown("Hello world!")
20
+ with Modal(visible=False) as modal2:
21
+ for i in range(100):
22
+ gr.Markdown("Hello world!")
23
  show_btn.click(lambda: Modal(visible=True), None, modal)
24
+ show_btn2.click(lambda: Modal(visible=True), None, modal2)
25
 
26
  if __name__ == "__main__":
27
  demo.launch()
src/backend/gradio_modal/modal.pyi CHANGED
@@ -102,8 +102,8 @@ class Modal(BlockContext, metaclass=ComponentMeta):
102
  preprocess: If False, will not run preprocessing of component data before running 'fn' (e.g. leaving it as a base64 string if this method is called with the `Image` component).
103
  postprocess: If False, will not run postprocessing of component data before returning 'fn' output to the browser.
104
  cancels: A list of other events to cancel when this listener is triggered. For example, setting cancels=[click_event] will cancel the click_event, where click_event is the return value of another components .click method. Functions that have not yet run (or generators that are iterating) will be cancelled, but functions that are currently running will be allowed to finish.
105
- every: Run this event 'every' number of seconds while the client connection is open. Interpreted in seconds. Queue must be enabled.
106
- trigger_mode: If "once" (default for all events except `.change()`) would not allow any submissions while an event is pending. If set to "multiple", unlimited submissions are allowed while pending, and "always_last" (default for `.change()` event) would allow a second submission after the pending event is complete.
107
  js: Optional frontend js method to run before running 'fn'. Input arguments for js method are values of 'inputs' and 'outputs', return should be a list of values for output components.
108
  concurrency_limit: If set, this is the maximum number of this event that can be running simultaneously. Can be set to None to mean no concurrency_limit (any number of this event can be running simultaneously). Set to "default" to use the default concurrency limit (defined by the `default_concurrency_limit` parameter in `Blocks.queue()`, which itself is 1 by default).
109
  concurrency_id: If set, this is the id of the concurrency group. Events with the same concurrency_id will be limited by the lowest set concurrency_limit.
 
102
  preprocess: If False, will not run preprocessing of component data before running 'fn' (e.g. leaving it as a base64 string if this method is called with the `Image` component).
103
  postprocess: If False, will not run postprocessing of component data before returning 'fn' output to the browser.
104
  cancels: A list of other events to cancel when this listener is triggered. For example, setting cancels=[click_event] will cancel the click_event, where click_event is the return value of another components .click method. Functions that have not yet run (or generators that are iterating) will be cancelled, but functions that are currently running will be allowed to finish.
105
+ every: Run this event 'every' number of seconds while the client connection is open. Interpreted in seconds.
106
+ trigger_mode: If "once" (default for all events except `.change()`) would not allow any submissions while an event is pending. If set to "multiple", unlimited submissions are allowed while pending, and "always_last" (default for `.change()` and `.key_up()` events) would allow a second submission after the pending event is complete.
107
  js: Optional frontend js method to run before running 'fn'. Input arguments for js method are values of 'inputs' and 'outputs', return should be a list of values for output components.
108
  concurrency_limit: If set, this is the maximum number of this event that can be running simultaneously. Can be set to None to mean no concurrency_limit (any number of this event can be running simultaneously). Set to "default" to use the default concurrency limit (defined by the `default_concurrency_limit` parameter in `Blocks.queue()`, which itself is 1 by default).
109
  concurrency_id: If set, this is the id of the concurrency group. Events with the same concurrency_id will be limited by the lowest set concurrency_limit.
src/demo/app.py CHANGED
@@ -7,6 +7,7 @@ with gr.Blocks() as demo:
7
  text_2 = gr.Textbox(label="Input 2")
8
  text_1.submit(lambda x:x, text_1, text_2)
9
  show_btn = gr.Button("Show Modal")
 
10
  gr.Examples(
11
  [["Text 1", "Text 2"], ["Text 3", "Text 4"]],
12
  inputs=[text_1, text_2],
@@ -14,8 +15,13 @@ with gr.Blocks() as demo:
14
  with gr.Tab("Tab 2"):
15
  gr.Markdown("This is tab 2")
16
  with Modal(visible=False) as modal:
17
- gr.Markdown("Hello world!")
 
 
 
 
18
  show_btn.click(lambda: Modal(visible=True), None, modal)
 
19
 
20
  if __name__ == "__main__":
21
  demo.launch()
 
7
  text_2 = gr.Textbox(label="Input 2")
8
  text_1.submit(lambda x:x, text_1, text_2)
9
  show_btn = gr.Button("Show Modal")
10
+ show_btn2 = gr.Button("Show Modal 2")
11
  gr.Examples(
12
  [["Text 1", "Text 2"], ["Text 3", "Text 4"]],
13
  inputs=[text_1, text_2],
 
15
  with gr.Tab("Tab 2"):
16
  gr.Markdown("This is tab 2")
17
  with Modal(visible=False) as modal:
18
+ for i in range(5):
19
+ gr.Markdown("Hello world!")
20
+ with Modal(visible=False) as modal2:
21
+ for i in range(100):
22
+ gr.Markdown("Hello world!")
23
  show_btn.click(lambda: Modal(visible=True), None, modal)
24
+ show_btn2.click(lambda: Modal(visible=True), None, modal2)
25
 
26
  if __name__ == "__main__":
27
  demo.launch()
src/frontend/Index.svelte CHANGED
@@ -11,6 +11,7 @@
11
  }>;
12
 
13
  let element: HTMLElement | null = null;
 
14
  const close = () => {
15
  visible = false;
16
  gradio.dispatch("blur");
@@ -30,13 +31,13 @@
30
  class:hide={!visible}
31
  id={elem_id}
32
  on:click={(evt) => {
33
- if (allow_user_close && evt.target === element) {
34
  close();
35
  }
36
  }}
37
  >
38
- <div class="modal-container">
39
- <Block height="100%">
40
  {#if allow_user_close}
41
  <div class="close" on:click={close}>
42
  <svg
@@ -114,9 +115,11 @@
114
  backdrop-filter: blur(4px);
115
  }
116
  .modal-container {
 
117
  padding: 0 var(--size-8);
118
  margin: var(--size-8) auto;
119
- max-height: calc(100% - var(--size-8));
 
120
  overflow-y: hidden;
121
  }
122
  .close {
@@ -139,6 +142,10 @@
139
  font-size: var(--button-small-text-size);
140
  cursor: pointer;
141
  }
 
 
 
 
142
 
143
  .hide {
144
  display: none;
 
11
  }>;
12
 
13
  let element: HTMLElement | null = null;
14
+ let inner_element: HTMLElement | null = null;
15
  const close = () => {
16
  visible = false;
17
  gradio.dispatch("blur");
 
31
  class:hide={!visible}
32
  id={elem_id}
33
  on:click={(evt) => {
34
+ if (allow_user_close && (evt.target === element || evt.target === inner_element)) {
35
  close();
36
  }
37
  }}
38
  >
39
+ <div class="modal-container" bind:this={inner_element} >
40
+ <Block allow_overflow={false} elem_classes={["modal-block"]}>
41
  {#if allow_user_close}
42
  <div class="close" on:click={close}>
43
  <svg
 
115
  backdrop-filter: blur(4px);
116
  }
117
  .modal-container {
118
+ position: relative;
119
  padding: 0 var(--size-8);
120
  margin: var(--size-8) auto;
121
+ height: 100%;
122
+ max-height: calc(100% - var(--size-16));
123
  overflow-y: hidden;
124
  }
125
  .close {
 
142
  font-size: var(--button-small-text-size);
143
  cursor: pointer;
144
  }
145
+ .modal :global(.modal-block) {
146
+ max-height: 100%;
147
+ overflow-y: auto !important;
148
+ }
149
 
150
  .hide {
151
  display: none;