Spaces:
Sleeping
Sleeping
Update textbox_with_upload.py
Browse files- textbox_with_upload.py +3 -2
textbox_with_upload.py
CHANGED
@@ -1,11 +1,14 @@
|
|
1 |
import gradio as gr
|
2 |
from gradio.components import Textbox
|
3 |
from gradio.components.base import Component
|
|
|
4 |
|
|
|
5 |
class TextboxWithUpload(Textbox):
|
6 |
def __init__(self, *args, **kwargs):
|
7 |
super().__init__(*args, **kwargs)
|
8 |
self.upload_button = None
|
|
|
9 |
|
10 |
def add_upload_button(self):
|
11 |
self.upload_button = gr.UploadButton("π", file_types=["text"], file_count="single")
|
@@ -24,5 +27,3 @@ class TextboxWithUpload(Textbox):
|
|
24 |
|
25 |
def get_block_name(self):
|
26 |
return "textboxwithupload"
|
27 |
-
|
28 |
-
gr.components.COMPONENT_MAPPING["textboxwithupload"] = TextboxWithUpload
|
|
|
1 |
import gradio as gr
|
2 |
from gradio.components import Textbox
|
3 |
from gradio.components.base import Component
|
4 |
+
from gradio import component
|
5 |
|
6 |
+
@component
|
7 |
class TextboxWithUpload(Textbox):
|
8 |
def __init__(self, *args, **kwargs):
|
9 |
super().__init__(*args, **kwargs)
|
10 |
self.upload_button = None
|
11 |
+
self.add_upload_button()
|
12 |
|
13 |
def add_upload_button(self):
|
14 |
self.upload_button = gr.UploadButton("π", file_types=["text"], file_count="single")
|
|
|
27 |
|
28 |
def get_block_name(self):
|
29 |
return "textboxwithupload"
|
|
|
|