Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,7 +6,6 @@ import gradio as gr
|
|
| 6 |
import spaces
|
| 7 |
import torch
|
| 8 |
from transformers import AutoModelForCausalLM, AutoTokenizer, TextIteratorStreamer
|
| 9 |
-
from pathlib import Path
|
| 10 |
|
| 11 |
|
| 12 |
MAX_MAX_NEW_TOKENS = 2048
|
|
@@ -144,23 +143,6 @@ with gr.Blocks(css="style.css") as demo:
|
|
| 144 |
chat_interface.render()
|
| 145 |
gr.Markdown(LICENSE)
|
| 146 |
|
| 147 |
-
def upload_file(filepath):
|
| 148 |
-
name = Path(filepath).name
|
| 149 |
-
return [gr.UploadButton(visible=False), gr.DownloadButton(label=f"Download {name}", value=filepath, visible=True)]
|
| 150 |
-
|
| 151 |
-
def download_file():
|
| 152 |
-
return [gr.UploadButton(visible=True), gr.DownloadButton(visible=False)]
|
| 153 |
-
|
| 154 |
-
with gr.Blocks() as demo:
|
| 155 |
-
gr.Markdown("First upload a file and and then you'll be able download it (but only once!)")
|
| 156 |
-
with gr.Row():
|
| 157 |
-
u = gr.UploadButton("Upload a file", file_count="single")
|
| 158 |
-
d = gr.DownloadButton("Download the file", visible=False)
|
| 159 |
-
|
| 160 |
-
u.upload(upload_file, u, [u, d])
|
| 161 |
-
d.click(download_file, None, [u, d])
|
| 162 |
-
|
| 163 |
-
|
| 164 |
|
| 165 |
if __name__ == "__main__":
|
| 166 |
demo.queue(max_size=20).launch()
|
|
|
|
| 6 |
import spaces
|
| 7 |
import torch
|
| 8 |
from transformers import AutoModelForCausalLM, AutoTokenizer, TextIteratorStreamer
|
|
|
|
| 9 |
|
| 10 |
|
| 11 |
MAX_MAX_NEW_TOKENS = 2048
|
|
|
|
| 143 |
chat_interface.render()
|
| 144 |
gr.Markdown(LICENSE)
|
| 145 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 146 |
|
| 147 |
if __name__ == "__main__":
|
| 148 |
demo.queue(max_size=20).launch()
|