Spaces:
Sleeping
Sleeping
Delete textbox_with_upload.py
Browse files- textbox_with_upload.py +0 -17
textbox_with_upload.py
DELETED
@@ -1,17 +0,0 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
|
3 |
-
class TextboxWithUpload(gr.Textbox):
|
4 |
-
def __init__(self, *args, **kwargs):
|
5 |
-
super().__init__(*args, **kwargs)
|
6 |
-
self.upload_button = gr.UploadButton("📎", file_types=["text"], file_count="single")
|
7 |
-
self.upload_button.upload(self.handle_upload, inputs=[self.upload_button], outputs=[self])
|
8 |
-
|
9 |
-
def handle_upload(self, file):
|
10 |
-
if file:
|
11 |
-
return file.name
|
12 |
-
return ""
|
13 |
-
|
14 |
-
def render(self):
|
15 |
-
textbox = super().render()
|
16 |
-
upload_button = self.upload_button.render()
|
17 |
-
return gr.Row([textbox, upload_button])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|